case 'gregorian':
// How many days does the month have?
$ts = strtotime($year . '-' . sprintf('%02d', $month) . '-01');
- $now = serendipity_serverOffsetHour(time(), true);
+ $now = serendipity_serverOffsetHour(time());
$nrOfDays = date('t', $ts);
$firstDayWeekDay = date('w', $ts);
$firstts = $ts;
$endts = mktime(0, 0, 0, $month + 1, 1, $year);
-
+
break;
-
+
case 'jalali-utf8':
-
+
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
-
+
list(,$jy, $jm, $jd) = $serendipity['uriArguments'];
- if( isset($jd) && $jd ){
+ if( isset($jd) && $jd ){
list ( $gy, $gm, $gd ) = j2g ($jy, $jm, $jd);
}elseif( isset($jm) && $jm ){
list ( $gy, $gm, $gd ) = j2g ( $jy, $jm, 1);
$gm = $month;
$gd = (int) date('d');
}
-
+
list ( $year, $month, $day ) = g2j ($gy, $gm, $gd);
-
+
// How many days does the month have?
$ts = strtotime($gy . '-' . sprintf('%02d', $gm) . '-' . sprintf('%02d', $gd));
- $now = serendipity_serverOffsetHour(time(), true);
+ $now = serendipity_serverOffsetHour(time());
$nrOfDays = jalali_strftime_utf('%m', $ts);
$j_days_in_month = array(0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
if ($year%4 == 3 && $nrOfDays == 12) $nrOfDays = $j_days_in_month[(int)$nrOfDays]+1;
else $nrOfDays = $j_days_in_month[(int)$nrOfDays];
-
+
// Calculate first timestamp of the month
list ($firstgy, $firstgm, $firstgd ) = j2g ( $year, $month, 1);
$firstts = mktime (0, 0, 0, $firstgm, $firstgd, $firstgy);
-
+
// Calculate first Jalali day, week day name
$firstDayWeekDay = date('w', $firstts);
-
+
// Calculate end timestamp of the month
list ( $end_year, $end_month, $end_day ) = j2g ($year, $month+1, 1);
$endts = mktime(0, 0, 0, $end_month, $end_day, $end_year);
break;
} // end switch
-
+
// Calculate the first day of the week, based on the beginning of the week ($bow)
if ($bow > $firstDayWeekDay) {
$firstDayWeekDay = $firstDayWeekDay + 7 - $bow;
$nextMonth = 1;
$nextYear = $year+1;
}
-
+
// Get first and last entry
$minmax = serendipity_db_query("SELECT MAX(timestamp) AS max, MIN(timestamp) AS min FROM {$serendipity['dbPrefix']}entries");
if (!is_array($minmax) || !is_array($minmax[0]) || $minmax[0]['min'] < 1 || $minmax[0]['max'] < 1) {
}
$rows = serendipity_db_query($querystring);
-
+
switch($serendipity['calendar']) {
default:
case 'gregorian':
$today_month = date('m', $now);
$today_year = date('Y', $now);
break;
-
+
case 'jalali-utf8':
$activeDays = array();
if (is_array($rows)) {
$today_month = jalali_date_utf('m', $now);
$today_year = jalali_date_utf('Y', $now);
break;
-
+
} // end switch
-
+
$externalevents = array();
if (serendipity_db_bool($this->get_config('enableExtEvents', false))) {
serendipity_plugin_api::hook_event('frontend_calendar', $externalevents, array('Month' => $month, 'Year' => $year,
// Print the calendar
$currDay = 1;
$nrOfRows = ceil(($nrOfDays+$firstDayWeekDay)/7);
-
for ($x = 0; $x < 6; $x++) {
// Break out if we are out of days
if ($currDay > $nrOfDays) {
$cellProps = array();
$printDay = '';
$link = '';
-
+
if ($x == 0) {
$cellProps['FirstRow'] = 1;
}
if ($x == $nrOfRows-1) {
$cellProps['LastRow'] = 1;
}
-
+
// If it's not a blank day, we print the day
if (($x > 0 || $y >= $firstDayWeekDay) && $currDay <= $nrOfDays) {
$printDay = $currDay;
-
+
if ($today_day == $currDay && $today_month == $month && $today_year == $year) {
$cellProps['Today'] = 1;
}
'classes' => implode(' ', array_keys($cellProps)));
} // end for
} // end for
-
+
$serendipity['smarty']->assign('plugin_calendar_weeks', $smartyRows);
-
+
$dow = array();
for ($i = 1; $i <= 7; $i++) {
$dow[] = array('date' => mktime(0, 0, 0, 3, $bow + $i - 1, 2004));
}
$serendipity['smarty']->assign('plugin_calendar_dow', $dow);
-
+
$serendipity['smarty']->assign('plugin_calendar_head', array('month_date' => $ts,
'uri_previous' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $previousYear, $previousMonth). $add_query),
'uri_month' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $year, $month) . $add_query),
'minScroll' => $minmax[0]['min'],
'maxScroll' => $minmax[0]['max']));
echo serendipity_smarty_fetch('CALENDAR', 'plugin_calendar.tpl');
-
+
} // end function
} // end class
}
$max_x = $this->get_config('count', 3);
-
+
for($x = 0; $x < $max_x; $x++) {
-
+
switch($this->get_config('frequency', 'months')) {
case 'months' :
switch($serendipity['calendar']) {
$propbag->add('description', ARCHIVE_FREQUENCY_DESC);
$propbag->add('default', 7);
break;
-
+
case 'use_links':
$propbag->add('type', 'tristate');
$propbag->add('name', INSTALL_TOP_AS_LINKS);
$propbag->add('description', ARCHIVE_FREQUENCY_DESC);
$propbag->add('default', 7);
break;
-
+
case 'use_links':
$propbag->add('type', 'tristate');
$propbag->add('name', INSTALL_TOP_AS_LINKS);
} else {
echo $this->get_config('content');
}
-
+
if (serendipity_userLoggedIn()) {
$is_plugin_owner = ($this->serendipity_owner == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers'));
-
+
if ($is_plugin_owner) {
echo '<div class="serendipity_edit_nugget"><a href="' . $serendipity['baseURL'] . '/serendipity_admin.php?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]=' . htmlentities($this->instance) . '">' . EDIT . '</a></div>';
}
$propbag->add('description', TITLE_FOR_NUGGET);
$propbag->add('default', CATEGORIES);
break;
-
+
case 'authorid':
$row_authors = serendipity_db_query("SELECT realname, authorid FROM {$serendipity['dbPrefix']}authors");
$authors = array('all' => ALL_AUTHORS);
case 'parent_base':
$categories = array('all' => ALL_CATEGORIES);
- $cats = serendipity_fetchCategories();
-
+ $cats = serendipity_fetchCategories();
+
if (is_array($cats)) {
$cats = serendipity_walkRecursive($cats, 'categoryid', 'parentid', VIEWMODE_THREADED);
foreach($cats as $cat) {
$cat_count[$cat['categoryid']] = $cat['postings'];
}
}
-
+
}
$html = '';
}
}
}
-
+
// Hide parents outside of our tree
if ($hide_parallel && $serendipity['GET']['category']) {
if ($hidedepth == 0 && $cat['parentid'] != $serendipity['GET']['category'] && $cat['categoryid'] != $serendipity['GET']['category']) {
$categories[$cid]['feedCategoryURL'] = serendipity_feedCategoryURL($cat, 'serendipityHTTPPath');
$categories[$cid]['categoryURL'] = serendipity_categoryURL($cat, 'serendipityHTTPPath');
$categories[$cid]['paddingPx'] = $cat['depth']*6;
-
+
if (!empty($cat_count[$cat['categoryid']])) {
$categories[$cid]['true_category_name'] = $cat['category_name'];
$categories[$cid]['category_name'] .= ' (' . $cat_count[$cat['categoryid']] . ')';
if (!$smarty) {
$html .= '<div style="padding-bottom: 2px;">';
-
+
if ($is_form) {
$html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiCat][]" value="' . $cat['categoryid'] . '" />';
}
-
+
if ( !empty($image) ) {
$html .= '<a href="'. $categories[$cid]['feedCategoryURL'] .'"><img src="'. $image .'" alt="XML" style="border: 0px" /></a> ';
}
if (!$smarty) {
$html .= sprintf(
'<br /><a href="%s" title="%s">%s</a>',
-
+
$serendipity['serendipityHTTPPath'] . $serendipity['indexFile'],
ALL_CATEGORIES,
ALL_CATEGORIES