 |
Satunnaisia kuvia galleriasta |
 |
 |
 |
 |
Ei tulevia tapahtumia |
 |
|
/*
+---------------------------------------------------------------+
| e107 website system
| e107 BLOG Engine by MacGuru
| GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/
class macgurublog_class {
var $weekdayn = array(MACGURUBLOG_MENU_34, MACGURUBLOG_MENU_35, MACGURUBLOG_MENU_36, MACGURUBLOG_MENU_37, MACGURUBLOG_MENU_38, MACGURUBLOG_MENU_39, MACGURUBLOG_MENU_40);
var $monthn = array('',MACGURUBLOG_MENU_41, MACGURUBLOG_MENU_42, MACGURUBLOG_MENU_43, MACGURUBLOG_MENU_44, MACGURUBLOG_MENU_45, MACGURUBLOG_MENU_46, MACGURUBLOG_MENU_47, MACGURUBLOG_MENU_48, MACGURUBLOG_MENU_49, MACGURUBLOG_MENU_50, MACGURUBLOG_MENU_51, MACGURUBLOG_MENU_52);
function dt($mode, $sendtime) {
$ido = getdate($sendtime);
$ev = sprintf('%04d', $ido['year']);
$honap = sprintf('%02d', $ido['mon']);
$nap = sprintf('%02d', $ido['mday']);
$hetnapszam = $ido['wday'];
$ora = sprintf('%02d', $ido['hours']);
$perc = sprintf('%02d', $ido['minutes']);
$mperc = sprintf('%02d', $ido['seconds']);
switch($mode) {
case 0:
$ret = ''.$ev.$honap.$nap.$ora.$perc.$mperc;
break;
case 1:
$ret = ''.$ev.'. '.$honap.'. '.$nap.'. '.$ora.':'.$perc.':'.$mperc;
break;
case 2:
$ret = ''.$ev.'. '.$this -> monthn[$honap+0].' '.$nap.'.';
break;
case 3:
$ret = ''.$ev.'. '.$this -> monthn[$honap+0].' '.$nap.', '.$this -> weekdayn[$hetnapszam];
break;
case 4:
$ret = ''.$honap.'. '.$nap.'. '.$ora.':'.$perc;
}
return $ret;
}
function own($id , $type=false) {
//$type true if comment
//$id id in the table
global $sql;
if ($type == true) {
$sql -> db_Select("macgurublog_com", "blogcom_rid", "blogcom_id=".$id);
$row = $sql -> db_Fetch();
extract($row);
$id = $row['blogcom_rid'];
}
$sql -> db_Select("macgurublog_rec", "blogrec_uid", "blogrec_id=".$id);
$row = $sql -> db_Fetch();
extract($row);
$id = $row['blogrec_uid'];
return(USERID == $id);
}
function gety($ts) {
//in ts
//out string
$t = getdate($ts);
return sprintf('%04d', $t['year']);
}
function getm($ts, $isstr=false) {
//in ts, boolean
//out string
$t = getdate($ts);
if (!$isstr) {
return sprintf('%02d', $t['mon']);
} else {
return $this -> monthn[$t['mon']];
}
}
function toym($ts) {
//in ts
//out ym
$t = getdate($ts);
return sprintf('%04d', $t['year']).sprintf('%02d', $t['mon']);
}
function tots($ym) {
//in ym
//out ts
return strtotime(substr($ym, 0, 4).'-'.substr($ym, 4, 2).'-01');
}
function isdif($a, $b) {
//in ts, ts
//out boolean
$a = getdate($a);
$b = getdate($b);
$ret = false;
if ($a['mon'] != $b['mon'] || $a['year'] != $b['year']) {
$ret = true;
}
return $ret;
}
function nextm($ym) {
//in ym
//out ts
if (substr($ym, 4, 2) == '12') {
$tb = strtotime((substr($ym, 0, 4)+1).'-01-01');
} else {
$tb = strtotime(substr($ym, 0, 4).'-'.(substr($ym, 4, 2)+1).'-01');
}
return $tb;
}
function istham($ym) {
//in ym
//out boolean
global $sql;
$ta = $this -> tots($ym);
$tb = $this -> nextm($ym);
$c = $sql -> db_Count('macgurublog_rec', '(*)', "where blogrec_date>=${ta} and blogrec_date<${tb}");
return ($c > 0);
}
}
$mgb = new macgurublog_class;
?>
/*
+---------------------------------------------------------------+
| e107 website system
| e107 BLOG Engine by MacGuru
| GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/
if (!defined(MACGURUBLOG_MENU_0)) {
require_once(e_PLUGIN."macgurublog_menu/languages/English.php");
}
if(defined("BULLET"))
{
$bullet = " ";
}
elseif(file_exists(THEME."images/bullet2.gif"))
{
$bullet = " ";
}
else
{
$bullet = "";
}
$text='';
$nil = true;
$obhidden = false;
$count = $sql->db_Count("macgurublog_main");
if ($count != 0) {
$sql -> db_Select("macgurublog_main");
$nsql = new db;
while($row = $sql-> db_Fetch()){
extract($row);
$nsql -> db_Select("user", "user_name", "user_id=".$row['blog_uid']);
$xrow = $nsql-> db_Fetch();
extract($xrow);
$name = $xrow['user_name'];
if ($row['blog_enable'] == 1) {
if ($row['blog_title'] != NULL) {
$bindex[strtolower($name)] = ''.$name.", \n";
} else {
$bindex[strtolower($name)] = ''.$name.", \n";
}
} elseif (getperms("P")) {
if ($row['blog_title'] != NULL) {
$bindex[strtolower($name)] = ''.$name.", \n";
} else {
$bindex[strtolower($name)] = ''.$name.", \n";
}
}
if ($row['blog_uid'] == USERID) {
$nil = false;
if ($row['blog_enable'] == 0) {
$obhidden = true;
}
}
}
//order
if (is_array($bindex)) {
ksort($bindex);
reset($bindex);
foreach($bindex as $row) {
$text .= $row;
}
} else {
$text .= MACGURUBLOG_MENU_1;
}
//
} else {
$text .= MACGURUBLOG_MENU_1;
}
if (USER === true) {
require(e_PLUGIN."macgurublog_menu/blognew.php");
if (!$pref['macgurublog_3']) {
$text .= ' '.$blognewlist.'';
}
if (($nil && !$pref['macgurublog_2']) || !$nil || getperms("P")) {
$text .= " ";
}
if ($nil && !$pref['macgurublog_2']) {
$text .= MACGURUBLOG_MENU_2 . " \n";
$text .= ''.MACGURUBLOG_MENU_3."\n";
$it = true;
} elseif (!$nil) {
if ($obhidden) {
$text .= MACGURUBLOG_MENU_20;
$text .=' '.MACGURUBLOG_MENU_21." \n";
}
$text .= $bullet.' '.MACGURUBLOG_MENU_5." \n";
$text .= $bullet.' '.MACGURUBLOG_MENU_4."\n";
$it = true;
}
if (getperms("P")) {
$text .= ($it?' ':'').$bullet.' '.MACGURUBLOG_MENU_76."\n";
}
if ($pref['macgurublog_3']) {
$text .= ' '.$blognewlist.'';
}
}
$title = MACGURUBLOG_MENU_0;
$ns -> tablerender($title, $text);
?> | |