function get_modules_list($size = 10, $offset = 0) { $modules = scandir(ABSPATH . '/' . MODULES); $res = array(); $i = $o = 0; foreach ($modules as $dir) { $path = ABSPATH . '/' . MODULES . '/' . $dir; if (is_dir($path) && file_exists($path . '/main.php')) { $o++; if ($o > $offset) { $i++; if ($i > $size) { break; } $custom = array('name' => $dir, 'description' => '', 'version' => '', 'author' => 'Unnamed', 'url' => ''); if (file_exists($path . '/info.json')) { $content = read_json($path . '/info.json', true); if ($content && is_assoc_array($content)) { $custom = set_merge($custom, $content, false, array('clear' => true)); } } $custom['path'] = $dir; $res[] = $custom; } } } return $res; }
public function GetReviewsArticlesMainFn() { $articles = array(); $itemsHome = read_json('home/' . NSPACE); foreach ($itemsHome as $item) { if (!isset($item->data->articles)) { continue; } foreach ($item->data->articles as $artdata) { if (isset($artdata->id)) { $article = $this->Data->DataArticleBasic($artdata->id); if ($article && $article->active && $article->type == 1) { $articles[] = $article->id; if (count($articles) >= 7) { return $articles; } } } else { foreach ($artdata as $artdata2) { $article = $this->Data->DataArticleBasic($artdata2->id); if ($article && $article->active && $article->type == 1) { $articles[] = $article->id; if (count($articles) >= 7) { return $articles; } } } } } } if (count($articles) >= 7) { return $articles; } $rest = $this->GetReviewsArticles($init = 0, $articles); foreach ($rest as $item) { $article = $this->Data->DataArticleBasic($item->id); if ($article && $article->active) { $articles[] = $article->id; if (count($articles) >= 7) { return $articles; } } } return $articles; }
function read_worksheet($out, $file, $options = array()) { $ext = pathinfo($file, PATHINFO_EXTENSION); if (isset($options["read"]) && $options["read"] != $ext) { fputs(STDERR, "Warning: The file extension was ignored to adopt {$options["read"]}.\n"); $ext = $options["read"]; } switch (strtolower($ext)) { case "raw": $in = fopen($file, "r"); while (($line = fgets($in)) !== false) { fputs($out, $line); } fclose($in); break; case "csv": $options["delimiter"] = ","; read_csv($out, $file, $options); break; case "tsv": $options["delimiter"] = "\t"; read_csv($out, $file, $options); break; case "xlsx": read_excel($out, $file, $options); break; case "json": read_json($out, $file, $options); break; case "yml": case "yaml": read_yaml($out, $file, $options); break; case "xml": read_xml($out, $file, $options); break; default: print "Error[{$ext}]: No reader is available.\n"; break; } return; }
public function getTagArticles($tag = 0) { $file = "tags/tag-{$tag}"; $json = read_json($file); if ($json) { if (time() - $json->time < 60 * 5) { return $json->articles; } } /*AND C.id_categoria_raiz IN (1,2,3,4,5,6,67,120)*/ $sql = "SELECT C.id, C.titulo_home as title, C.copete_home as subtitle, C.fecha as date, C.hora as hour,\n C.id_categoria_raiz as category, advf.advLink AS picture\n FROM contenidos C\n INNER JOIN contenidos_tags CT ON C.id = CT.id_contenido\n LEFT JOIN advf ON advf.advID = C.fotohome\n WHERE C.id \n AND CT.id_tag = '{$tag}' AND C.estado = 'A' AND C.activo = 'S'\n ORDER BY C.fecha DESC, C.hora DESC, C.id DESC\n LIMIT 0, 9"; $result = $this->db->query($sql)->result(); $articles = array(); foreach ($result as $article) { $articles[] = $this->Data->DataArticlePrep($article); } $data = array('time' => time(), 'articles' => $articles); write_json($file, $data); return $articles; }
$global_debug = false; } // put full path to Smarty.class.php require $app['_web_root'] . '/app/smarty/Smarty.class.php'; $smarty = new Smarty(); // Set up Smarty directories $smarty->setTemplateDir($app['_web_root'] . '/app/smarty/templates'); $smarty->setCompileDir($app['_web_root'] . '/app/smarty/templates_c'); $smarty->setCacheDir($app['_web_root'] . '/app/smarty/cache'); $smarty->setConfigDir($app['_web_root'] . '/app/smarty/configs'); $smarty->error_reporting = E_ALL ^ E_NOTICE; // Check that the smarty directories are writeable if (!is_writeable($smarty->compile_dir)) { print '<b>Error!</b> compile directory needs to be writeable. <br />'; print '<b>Fix:</b> chmod a+w ' . $smarty->compile_dir; exit; } // Start Session session_start(); // Application functions include $app['_web_root'] . '/app/include.php'; // Load application data include $app['_web_root'] . '/app/data.php'; read_json('Pages'); // Get current page name $app['_curPath'] = ""; if (!empty($directory)) { $app['_curPath'] = $directory . "/" . basename(getUrl()); } else { $app['_curPath'] = basename(getUrl()); }
?> ,Secciones trending MÁS COMPARTIDAS">Más compartidas</span></h2> </div> <div class="content-box"> <div class="content-box-inside"> <?php if (NSPACE == 'infonews23') { $file = "trending/infonews23-"; } elseif (NSPACE == 'el-grafico') { $file = "trending/el-grafico"; } else { $file = "trending/home-"; } $types = array('global', 'comments', 'visits', 'shares'); foreach ($types as $type) { $articles = read_json($file . $type); if (count($articles)) { $first = array_shift($articles); ?> <div class="content-box-item<?php echo $type == 'global' ? " active" : ""; ?> "> <div class="leftcol"> <?php foreach ($articles as $article) { ?> <div class="section-id-<?php echo $article->category; ?> widget-item">
public function GetHomeArticlesSection($section = 0, $articles = array()) { $itemsHome = read_json('home/' . NSPACE); foreach ($itemsHome as $item) { if (!isset($item->data->articles)) { continue; } foreach ($item->data->articles as $artdata) { if (isset($artdata->id)) { $article = $this->Data->DataArticleBasic($artdata->id); if ($article && $article->active && $article->category == $section) { if (!in_array($article->id, $articles)) { $articles[] = $article->id; } if (count($articles) >= 4) { return $articles; } } } else { foreach ($artdata as $artdata2) { $article = $this->Data->DataArticleBasic($artdata2->id); if ($article && $article->active && $article->category == $section) { if (!in_array($article->id, $articles)) { $articles[] = $article->id; } if (count($articles) >= 4) { return $articles; } } } } } } if (count($articles) >= 4) { return $articles; } $rest = $this->GetSectionArticles($section, $init = 0, $articles); foreach ($rest as $item) { $article = $this->Data->DataArticleBasic($item->id); if ($article && $article->active) { if (!in_array($article->id, $articles)) { $articles[] = $article->id; } if (count($articles) >= 4) { return $articles; } } } return $articles; }
<div class="section-id-<?php echo $this->Data->clientID ? $this->Data->clientID : $dSection->id; ?> app-wrapper"> <div class="app-inside"> <div class="top-section"> <ul> <li class="first"><a href="<?php echo base_url() . $dSection->link; ?> "><?php echo $dSection->name; ?> </a></li> <?php $tagsSection = read_json('tags/section-' . $dSection->id); foreach ($tagsSection as $t) { ?> <li class="tag"><a href="<?php echo base_url(); ?> tag/<?php echo $t->id; ?> /<?php echo prep_word_url($t->nombre); ?> "><span><?php echo $t->nombre; ?> </span></a></li>
} try { $a = new PharData($tar_file . '.tar'); $a->buildFromDirectory($target_dir . strtolower($zip_file['filename'])); $a->compress(Phar::GZ); unset($a); Phar::unlinkArchive($tar_file . '.tar'); } catch (Exception $e) { $response->status = 500; $response->message = $e->getMessage(); $response->json($response); } } $wrong_folder = current(explode(".", $_FILES["fileToUpload"]["name"])); //store data in DB $response = read_json($target_file, $id, 'gz', $wrong_folder); } else { $response->status = 500; $response->message = 'Sorry, your file was not uploaded.'; $response->json($response); } } } else { // echo "not logged in"; // header('Location: index.php'); // exit; $response = new Response(); $response->status = 403; $response->message = 'Unauthorized'; $response->json($response); }
<?php $menu = read_json('menu'); /* <style> body.namespace-infonews .infonews-menu.cbp-hrmenu > ul > li.infonews > a > span{ background-image: url('http://www.infonews.com/data/uploads/logo-infonews-navidad.png?v3'); } body.namespace-infonews .infonews-menu.cbp-hrmenu > ul > li.infonews.active > a > span { background-image: url('<?= layout() ?>ico/logos/infonews-blanco.png'); } </style> */ ?> <nav id="infonews-menu" class="cbp-hrmenu infonews-menu"> <ul> <?php foreach ($menu as $item => $data) { $exclude = array('infonews', 'rock&pop', 'splendid', 'todoshow', 'subportals', 'more', 'search'); $exclude2 = array('infonews23', 'elargentino'); if ((NSPACE == 'infonews23' || NSPACE == 'el-argentino') && in_array($item, $exclude)) { continue; } if (NSPACE != 'infonews23' && NSPACE != 'el-argentino' && in_array($item, $exclude2)) { continue; } ?> <li data-id="<?php echo $item; ?>
public function tags_cloud() { $file = 'widgets/tags_cloud'; $this->data['tags'] = read_json($file); $this->load->shview('widget/cloud', $this->data); }
<div class="article-list"> <?php $tags = read_json('widgets/tags_cloud'); $extra = array(0 => array('view' => 'characters_cloud', 'data' => array(true)), 1 => array('view' => 'cloud', 'data' => array('tags' => $tags)), 2 => array('view' => 'timeline-twitter.php', 'data' => array(true)), 5 => array('view' => 'review', 'data' => array(true))); $index = 0; for ($i = 0; $i < count($articles) + count($extra); $i++) { if (isset($extra[$i])) { if (count($extra[$i]['data']) && $init == 0) { ?> <div class="grid-item col-md-4"><?php $this->load->shview("widget/{$extra[$i]['view']}", $extra[$i]['data']); ?> <div class="clear"></div> </div><?php } } else { $article = $this->Data->DataArticleList($articles[$index]->id); $index++; $this->load->shview("tag/article", array('article' => $article)); } } ?> <?php /* <div class="widget-section-list"> <div class="leftcol"> <? $this->load->shview("tag/articles") ?> </div>
<?php $file = "home/elgrafico"; $json = read_json($file); ?> <section class="widget-last-infonews"> <div class="app-inside"> <div class="widget-inside"> <a href="http://elgraficodiario.infonews.com/" target="_blank"> <img src="<?php echo layout('nspaces/radioamerica/logo-eg.png'); ?> " alt="El Gráfico Diario"> </a> <h1>Últimas noticias</h1> <div class="row"> <?php $i = 0; foreach ($json as $key => $value) { if (!isset($value->data) or !isset($value->data->articles)) { continue; } foreach ($value->data->articles as $k => $article) { ?> <?php if (isset($this->data['last-infonews-ids']) && in_array($article->id, $this->data['last-infonews-ids'])) { continue;
public function index_infonews23() { $this->parse_infonews23_json(); #$this->data['itemsHome'] = read_json('home/infonews23'); #$this->data['EpSection'] = 'infonews-home'; $this->load->config('seo', TRUE); $this->data['appSection'] = 'app-section-home'; $this->data['headers'] = array(); $this->data['headers']['title'] = $this->config->item('infonews-title', 'seo'); $this->data['headers']['head-title'] = $this->config->item('infonews-title', 'seo'); $this->config->item('client', 'app'); $tagsTitle = read_json('tags/infonews'); if (count($tagsTitle)) { $tags = array(); foreach ($tagsTitle as $t) { $tags[] = rtrim(trim($t->nombre)); } $this->data['headers']['head-title'] = implode(', ', $tags) . ' | ' . $this->config->item('infonews-title', 'seo'); } $this->data['headers']['description'] = $this->config->item('infonews-description', 'seo'); $this->data['headers']['keywords'] = $this->config->item('infonews-keywords', 'seo'); $this->data['headers']['customData'] = $this->load->shview('widget/metatags-rss', $this->data, true); $this->load->nsview('home/index', $this->data); }
ini_set('display_errors', 'Off'); } $BLOCK = false; //Получаю все важные данные для ядра require_once ABSPATH . INCLUDES . '/basic-config.php'; //Подсоединяем БД require_once ABSPATH . INCLUDES . '/basic-db.php'; //Подключать дополнительные функции require_once ABSPATH . INCLUDES . '/basic-functions.php'; //Получаю информацию о движке $SYSTEM = new stdClass(); $SYSTEM->name = 'Detemiro Engine'; $SYSTEM->version = '1.0'; $SYSTEM->nick = 'Basic'; if (file_exists(ABSPATH . INCLUDES . '/log/system.json')) { $content = read_json(ABSPATH . INCLUDES . '/log/system.json', false); if ($content && is_object($content)) { $SYSTEM->version = isset($content->version) && $content->version ? $content->version : '1.0'; $SYSTEM->nick = isset($content->nick) && $content->nick ? $content->nick : 'custom'; } } //Работа с опциями require_once ABSPATH . INCLUDES . '/basic-options.php'; //Безопасность require_once ABSPATH . INCLUDES . '/basic-secure.php'; //Работа с пользователями require_once ABSPATH . INCLUDES . '/basic-users.php'; //Работа с системными сообщениями require_once ABSPATH . INCLUDES . '/basic-messages.php'; //Работа с модулями require_once ABSPATH . INCLUDES . '/basic-modules.php';
<?php $tagsTitle = read_json('tags/infonews'); if (count($tagsTitle)) { ?> <div class="topics"> <div class="app-inside"> <ul> <?php foreach ($tagsTitle as $t) { ?> <li><a href="<?php echo base_url(); ?> tag/<?php echo $t->id; ?> /<?php echo prep_word_url($t->nombre); ?> "><?php echo $t->nombre; ?> </a></li> <?php } ?> </ul> </div> </div> <?php
public function GetLastVideos($section = 0) { $file = "videos/section-infonews"; $where = ""; if (!$this->clientID && $section) { $where = "v.id_categoria = '{$section}' AND "; $file = "videos/section-{$section}"; } $json = read_json($file); if ($json) { if (time() - $json->time < 60 * 5) { return $json->videos; } } $sql = "select v.id, v.id_categoria as category, v.titulo as title, v.copete as subtitle, v.codigo as code, v.fecha as date, v.hora as hour\n from videos v \n where {$where} v.activo = 'S' and v.estado = 'A'\n order by v.fecha desc\n Limit 0,3"; $result = $this->db->query($sql)->result(); $videos = array(); foreach ($result as $video) { $videos[] = $this->Data->DataVideoPrep($video); } $data = array('time' => time(), 'videos' => $videos); write_json($file, $data); return $videos; }