function leerFeedCategoria($categoria) { global $npag; global $cant; //http://gdata.youtube.com/feeds/api/videos/-/music $url_api = "http://gdata.youtube.com/feeds/api/videos/-/music?time=today"; $sxml = simplexml_load_file($url_api); $contador = 0; foreach ($sxml->entry as $entry) { global $i; $i++; $media = $entry->children('http://search.yahoo.com/mrss/'); $attrs = $media->group->player->attributes(); $url[$i] = $attrs['url']; $titulo[$i] = $media->group->title; $titulo[$i] = substr(ucwords($titulo[$i]), 0, 50); $descripcion[$i] = $media->group->description; $etiqueta[$i] = $media->group->keywords; empty($etiqueta[$i]) ? $etiqueta[$i] = "Music" : ($etiqueta[$i] = $etiqueta[$i]); // get thumbnail $attrs = $media->group->thumbnail[0]->attributes(); $img[$i] = $attrs['url']; // get <yt:duration> node for video length $yt = $media->children('http://gdata.youtube.com/schemas/2007'); $attrs = $yt->duration->attributes(); $length[$i] = $attrs['seconds']; //*****OK $yt = $entry->children('http://gdata.youtube.com/schemas/2007'); $attrs = $yt->statistics->attributes(); @($viewCount[$i] = $attrs['viewCount']); // buscar "google vs bing" ERROR ERROR ERROR ERROR PASADO POR ALTO PROVAR $gd = $entry->children('http://schemas.google.com/g/2005'); if ($gd->rating) { $attrs = $gd->rating->attributes(); $rating[$i] = $attrs['average']; } else { $rating[$i] = 0; } //usa include functions.php $url_amigable = urls_amigables($titulo[$i]); // Creando Array almacen de DATOS $vid[$i] = array('titulo' => strtolower($titulo[$i]), 'id' => getIde($url[$i]), 'img' => 'http://img.youtube.com/vi/' . getIde($url[$i]) . '/hqdefault.jpg', 'duracion' => minutes($length[$i]), 'pag_video' => '' . getIde($url[$i]) . '-' . $url_amigable . '.html', 'url_amigable' => $url_amigable, 'pag_tag' => 'video.php?tag=', 'descripcion' => $descripcion[$i], 'contador_view' => $viewCount[$i], 'etiqueta' => strtolower($etiqueta[$i])); } //FIN foreach return $vid; }
/** * Create URL api * https://www.googleapis.com/youtube/v3/search?part=snippet&relatedToVideoId=5rOiW_xY-kc&type=video&key={YOUR_API_KEY} */ public function cargarDatos($maxResults = 5) { $config = $this->readConfig(); $api_url = 'https://www.googleapis.com/youtube/v3/search?part=snippet&relatedToVideoId=' . $this->getID() . '&maxResults=' . $maxResults . '&type=video&key=' . $config['pagina']['your_api_key']; $string = file_get_contents($api_url); $json = json_decode($string, true); $video = array(); if (!is_null($json) && is_array($json) && isset($json['pageInfo'])) { foreach ($json['items'] as $key => $value) { $data_id = $value['id']['videoId']; $data_O1 = $value['snippet']; $url_amigable = urls_amigables($data_O1['title']); $video[] = array('titulo' => $data_O1['title'], 'url' => 'https://www.youtube.com/watch?v=' . $data_id, 'id' => $data_id, 'img' => $data_O1['thumbnails']['medium']['url'], 'pag_vid' => $config['pagina']['host'] . $data_id . '-' . $url_amigable . '.html', 'pag_etiqueta' => 'video.php?tag=', 'duracion' => '123', 'contador_view' => '', 'etiqueta' => ''); } } return $video; }
/** * example * https://www.googleapis.com/youtube/v3/search?part=snippet&order=viewCount&type=video&q=selena+gomez&key=AIzaSyAU5Qr9YKw_zA28JheHmcFGyDpd-W7gipw * */ function leer_feed($q, $npag, $cant) { $configuracion = parse_ini_file("config/config.ini", TRUE); $YOUR_API_KEY = $configuracion['pagina']['your_api_key']; $maxResults = $cant; //$cant; //$q = 'selena+gomez'; $stringPageToken = isset($_REQUEST['pageToken']) ? '&pageToken=' . $_REQUEST['pageToken'] : ''; $url_api = 'https://www.googleapis.com/youtube/v3/search' . '?part=snippet' . '&maxResults=' . $maxResults . '&type=video' . '&q=' . $q . $stringPageToken . '&key=' . $YOUR_API_KEY; $string = file_get_contents($url_api); $json = json_decode($string, true); $pageTokenNext = ''; $pageTokenPrev = ''; $items = array(); if (!is_null($json) && is_array($json) && isset($json['nextPageToken'])) { $pageTokenNext = $json['nextPageToken']; $pageTokenPrev = isset($json['prevPageToken']) ? $json['prevPageToken'] : ''; if (isset($json['items']) && count($json['items']) > 0) { foreach ($json['items'] as $key => $value) { $data_id = $value['id']['videoId']; $data_O1 = $value['snippet']; $url_amigable = urls_amigables($data_O1['title']); $items[] = array('titulo' => $data_O1['title'], 'id' => $data_id, 'img' => $data_O1['thumbnails']['medium']['url'], 'duracion' => '5:00', 'pag_video' => $data_id . '-' . $url_amigable . '.html', 'url_amigable' => $url_amigable, 'pag_tag' => 'video.php?tag=', 'descripcion' => $data_O1['description'], 'contador_view' => '123', 'etiqueta' => 'etiqueta'); } //FIN foreach } } $return['page_next'] = '?q=' . $q; if ($npag >= 1) { $return['page_next'] .= !empty($pageTokenNext) ? '&pageToken=' . $pageTokenNext : ''; } $return['page_prev'] = '?q=' . $q; if ($npag > 1) { $return['page_prev'] .= !empty($pageTokenPrev) ? '&pageToken=' . $pageTokenPrev : ''; } $return['items'] = $items; return $return; }
include_once '../includes/helpers.php'; require_once '../includes/class.upload.php'; include 'includes/valida-login.php'; include 'includes/meta.php'; $id_seccion = 'PUBLICIDAD_HOME_POPUP'; $bErr = 0; if (_IS_POST()) { $categoria = $_POST['categoria']; $titulo = sanitize_sql_string($_POST['titulo']); $fecha = sanitize_sql_string($_POST['fecha']); $descripcion = sanitize_sql_string($_POST['descripcion']); $target = $_POST['target']; $link = $_POST['link']; $imagen = $_POST['himagen']; $imagen_temp = $_POST['himagen_temp']; $url_ami = urls_amigables($titulo, 'publicidad'); $portada = $_POST['portada'] == '' ? '0' : '1'; if ($_POST['chkborrar'] == '1') { $imagen = ''; $imagen_temp = ''; } // IMAGENES DE publicidad $i = 1; if (is_array($_FILES['imagen' . $i]) && $_FILES['imagen' . $i]['name'] != '') { $oImgReg = new Upload($_FILES['imagen' . $i]); if ($oImgReg->uploaded) { $oImgReg->Process('../publicidad/temp/'); if ($oImgReg->processed) { $imagen_temp = $oImgReg->file_dst_name; } //$oImgReg->image_resize = true;
$name = $_POST['nombre']; $address = $_POST['direcc']; $lat = $_GET['lat']; $lng = $_GET['lng']; $type = $_GET['type']; $desc = $_POST['desc']; $ldesc = str_replace(chr(13), "<br>", $_POST['ldesc']); $precio = $_POST['precio']; $web = $_POST['web']; $tipo_co = $_POST['tipo_co']; $etiq = $_POST['etiq']; $phone = $_POST['phone']; $citz = $_POST['citz']; $punt = "0"; $res_on = "si"; $image = $urrl; $titulo_f = urls_amigables($name); $time = time(); // Opens a connection to a MySQL server // Insert new row with user data $query = sprintf("INSERT INTO markers " . " (`id`, `name`, `address`, `lat`, `lng`, `type`, `image`, `precio_medio`, `puntuacion`, `descripcion`, `desc_long`, `reserva_onl`, `tipo_cocina`, `web`, `tags`, `medio_user` , `titulo_f` , `city`, `phone` , `time`) " . " VALUES (NULL, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' , '%s' , '%s' , '%s' , '%s' , '%s', '%s');", mysql_real_escape_string($name), mysql_real_escape_string($address), mysql_real_escape_string($lat), mysql_real_escape_string($lng), mysql_real_escape_string($type), mysql_real_escape_string($image), mysql_real_escape_string($precio), mysql_real_escape_string($punt), mysql_real_escape_string($desc), mysql_real_escape_string($ldesc), mysql_real_escape_string($res_on), mysql_real_escape_string($tipo_co), mysql_real_escape_string($web), mysql_real_escape_string($etiq), mysql_real_escape_string($username), mysql_real_escape_string($titulo_f), mysql_real_escape_string($citz), mysql_real_escape_string($phone), mysql_real_escape_string($time)); $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } $ver_todoo = mysql_query("SELECT * FROM markers WHERE medio_user = '******' ;"); while ($prodroww = mysql_fetch_array($ver_todoo)) { $iddd = $prodroww['id']; $tit = $prodroww['titulo_f']; } print "<script>document.location.href='sitio/" . $tit . "'</script>";
include_once '../includes/nocache.php'; include_once '../includes/config.php'; include_once '../includes/sanitize.php'; include_once '../includes/helpers.php'; require_once '../includes/class.upload.php'; include 'includes/valida-login.php'; include 'includes/meta.php'; if (_IS_POST()) { $categoria = $_POST['categoria']; $titulo = sanitize_sql_string($_POST['titulo']); $fecha = sanitize_sql_string($_POST['fecha']); $descripcion = sanitize_sql_string($_POST['descripcion']); $target = $_POST['target']; $link = $_POST['link']; $url_ami = urls_amigables($titulo, 'marcas'); $portada = $_POST['portada'] == '' ? '0' : '1'; // IMAGENES DE marcas $i = 0; foreach ($_FILES as $imagenesT) { $i++; if (is_array($_FILES['imagen' . $i]) && $_FILES['imagen' . $i]['name'] != '') { $oImgReg = new Upload($_FILES['imagen' . $i]); if ($oImgReg->uploaded) { $oImgReg->Process('../marcas/temp/'); if ($oImgReg->processed) { $imagen = $oImgReg->file_dst_name; } $oImgReg->image_resize = true; $oImgReg->image_ratio_fill = true; $oImgReg->image_x = 100;
<?php include_once '../includes/nocache.php'; include_once '../includes/config.php'; include_once '../includes/sanitize.php'; include_once '../includes/helpers.php'; require_once '../includes/class.upload.php'; include 'includes/valida-login.php'; include 'includes/meta.php'; if (_IS_POST()) { $categoria = sanitize_sql_string($_POST['categoria']); $titulo = sanitize_sql_string($_POST['titulo']); $url_ami = urls_amigables($titulo, 'categorias'); $orden = $db->select(getOne, 'categorias', array('select' => 'max(orden)', 'order' => 'orden')); $campos = array('titulo' => $titulo, 'url_amigable' => $url_ami, 'orden' => $orden + 1); $db->insert('categorias', $campos); redirige_pagina('categorias_registro.php?err=2'); } ?> <link href='http://fonts.googleapis.com/css?family=Ubuntu:300,400,700' rel='stylesheet' type='text/css'> <link href="css/styles.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script> <script type="text/javascript" src="js/validate/jquery.validate.js"></script> <script language="javascript"> $(document).ready(function() { $("#formulario").validate({ rules: { titulo: "required",
<?php session_start(); include "config.php"; $ver_todo = mysql_query("SELECT * FROM markers ;"); while ($prodrow = mysql_fetch_array($ver_todo)) { $id = $prodrow['id']; $titulo_f = $prodrow['name']; $titulo_f = urls_amigables($titulo_f); $vsi = mysql_query("SELECT * FROM markers WHERE titulo_f = '{$titulo_f}' ;"); $nu = mysql_num_rows($vsi); if ($nu > 0) { $titulo_f = $titulo_f . "-" . $nu; } mysql_query("UPDATE `quecome_quecomes`.`markers` SET `titulo_f` = '{$titulo_f}' WHERE `markers`.`id` ='{$id}' LIMIT 1 ;"); echo "actualizado: " . $id . " :" . $titulo_f . "<br>"; }
<?php include_once '../includes/nocache.php'; include_once '../includes/config.php'; include_once '../includes/sanitize.php'; include_once '../includes/helpers.php'; require_once '../includes/class.upload.php'; include 'includes/valida-login.php'; include 'includes/meta.php'; if (_IS_POST()) { $categoria = $_POST['categoria']; $marca = $_POST['marca']; $titulo = sanitize_sql_string($_POST['titulo']); $descripcion = sanitize_sql_string($_POST['descripcion']); $url_ami = urls_amigables($titulo, 'modelos'); $campos = array('id_marca' => $marca, 'titulo' => $titulo, 'url_amigable' => $url_ami, 'fecha' => date('Y-m-d'), 'estado' => '1'); $db->insert('modelos', $campos); redirige_pagina("modelos_registro.php?err=2"); } ?> <link href='http://fonts.googleapis.com/css?family=Ubuntu:300,400,700' rel='stylesheet' type='text/css'> <link href="css/styles.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script> <script type="text/javascript" src="js/botonera.js"></script> <script type="text/javascript" src="js/validate/jquery.validate.js"></script> <script language="javascript"> $(document).ready(function() { $("#formulario").validate({ rules: {
<?php $videoID = !empty($_REQUEST['v']) ? substr($_REQUEST['v'], 0, 11) : ''; $pag_estado = !empty($_GET['p']) ? $_GET['p'] : ''; $data_video = imprimir($videoID, $pag_estado, $YOUR_API_KEY); $video = $data_video[0]; //$video; //ARRAy datos almacen /**********************************************************************/ $videoTitulo = substr(ucwords($video['titulo']), 0, 50); $url_1 = $video['id']; $url_2 = urls_amigables($videoTitulo); $id = $url_1 . '-' . $url_2; /*********************************************************************/ /** * https://www.googleapis.com/youtube/v3/videos?id='+id_youtube+'&key='+YOUR_API_KEY+'&part=snippet,contentDetails,statistics,status */ function imprimir($videoID, $pag_estado, $YOUR_API_KEY) { $video = false; if (!empty($pag_estado)) { $video = false; } else { $url_api = 'https://www.googleapis.com/youtube/v3/videos' . '?id=' . $videoID . '&part=snippet,contentDetails,statistics,status' . '&key=' . $YOUR_API_KEY; $string = file_get_contents($url_api); $json = json_decode($string, true); $video = array(); if (!is_null($json) && is_array($json) && isset($json['pageInfo'])) { foreach ($json['items'] as $key => $value) { $data_id = $json['items'][$key]['id']; $data_O1 = $value['snippet']; $video[] = array('titulo' => $data_O1['title'], 'url' => 'https://www.youtube.com/watch?v=' . $data_id, 'id' => $data_id, 'img' => $data_O1['thumbnails']['medium']['url'], 'pag_video' => 'video.php?v=' . $data_id, 'pag_etiqueta' => 'video.php?tag=', 'duracion' => '123', 'etiqueta' => 'etiqueta', 'descripcion' => descripcion_c($data_O1['description']));