core/api/modules/clock/class.php

113 lines
4.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
class main{
var $db; // Здесь объект для работы с MySQL
var $id;
function __construct( $smarty, $settings ){
$db = $this -> db;
if( $settings['cachePage'] > 0 ){
$smarty -> caching = true;
$smarty -> cache_lifetime = $settings['cachePage'];
}
/*
$db -> free_sql2("
CREATE TABLE IF NOT EXISTS `foto_albums` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`user_id` int(10) DEFAULT NULL,
`srok` varchar(30) DEFAULT NULL,
`t` varchar(30) DEFAULT NULL,
`naim` varchar(254) DEFAULT NULL,
`reyt` int(10) DEFAULT 0,
`img` varchar(15) DEFAULT NULL,
`cena` int(6) DEFAULT NULL,
`roznica` varchar(250) DEFAULT NULL,
`private` int(1) DEFAULT 0,
`public` int(1) DEFAULT 1,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
CONSTRAINT `foto_albums_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
$db -> free_sql( "CREATE TABLE `foto_img` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`user_id` int(10) DEFAULT NULL,
`private` int(1) DEFAULT 0,
`album_id` int(10) DEFAULT NULL,
`img` varchar(15) DEFAULT NULL,
`tags` varchar(254) DEFAULT NULL,
`reyt` int(10) DEFAULT 0,
`downloads` int(10) DEFAULT NULL,
`t` varchar(30) DEFAULT NULL,
`naim` varchar(254) DEFAULT NULL,
`audit` int(1) DEFAULT 0,
`data_s` varchar(250) DEFAULT NULL,
`size` varchar(20) DEFAULT NULL,
`md5` varchar(100) DEFAULT NULL,
`opis` longtext DEFAULT NULL,
`t_info` varchar(250) DEFAULT NULL,
`public` int(1) DEFAULT 1,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `album_id` (`album_id`),
CONSTRAINT `foto_img_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
CONSTRAINT `foto_img_ibfk_2` FOREIGN KEY (`album_id`) REFERENCES `foto_albums` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;" );
*/
$this -> settings = $settings;
}
/* ------------------------------------------------------------------------------------------------------------------------- */
function get_news($limit){ // получение новостей
$a['cat']=1;
$a['public']=1;
$db=$this->db;
$db->or_by_desc=1;
$postrow=$db->get_massiv('pages', $a, 'd', $limit);
@$num = count($postrow);
for($i = 0; $i < $num; $i++){
$y=substr($postrow[$i]['d'], 0, 4);
$m=substr($postrow[$i]['d'], 5, 2);
$d=substr($postrow[$i]['d'], 8, 2);
$postrow[$i]['dd']=$d . '.' . $m . '.' . $y;
}
return $postrow;
}
/* ------------------------------------------------------------------------------------------------------------------------- */
function get_last_page( $limit ){ // Получаем последние страницы
$db = $this -> db;
$db -> or_by_desc = 1;
$a['public']=1;
$postrow = $db -> get_massiv( 'pages', $a, 't', $limit );
@$num = count ( $postrow );
for ( $i = 0; $i < $num; $i++ ) {
$a['id'] = $postrow[$i]['pages_cat'];
$postrow[$i]['pages_cat'] = $db -> get_val ( 'pages_cat', $a, 'title' );
}
return $postrow;
}
/* ------------------------------------------------------------------------------------------------------------------------- */
function get_slider(){ // Получаем слайдер
$db = $this -> db;
$db->or_by_desc=0;
$db -> get_massiv ( 'slider' ); //исполняем функцию с параметрами
$sliders = $db->result; //получаем результат
$this->id=$sliders[0]['id'];
return $sliders;
}
/* ------------------------------------------------------------------------------------------------------------------------- */
function get_carusel(){ // Получаем баннеры из папки
if ( file_exists ( MYDIR . '/files/template/banner' ) ) {
include_once ( MYDIR . '/api/php/list_file.php' );
$listfile = list_file ( MYDIR . '/files/template/banner' );
$c = count ( $listfile );
for ( $i = 0; $i < $c; $i++ ) $karusel[$i] = '/files/template/banner/' . $listfile[$i];
return $karusel;
}
}
}
?>