Top > diary > 2006-12-29

今日から休みです Edit

 休みだ~って事で、ゆっくりできるわけでもなく、まだ部屋の掃除とかお買い物とか年越し前の作業が残ってるわけで…。

minicalendar.inc.php Edit

 前から気になっていたのですが、ここのサイトって日記ページは編集制限しているからPukiWiki仕様だとダメサイトの代表例的な無駄なリンクが大量に出来上がっちゃうわけで、ちょっと改造してみることにしました。

  • 121行目辺り
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
+	$user = auth::check_auth();
	
	while (checkdate($m_num,$day,$year)) {
		$dt = sprintf('%4d-%02d-%02d', $year, $m_num, $day);
		$page = $prefix.$dt;
		$r_page = rawurlencode($page);
		$s_page = htmlspecialchars($page);
 
		$h_today = public_holiday($year,$m_num,$day);
		$hday = $h_today['rc'];
		
		if ($wday == 0 and $day > 1) {
			$ret .= "    </tr>\n    <tr>\n";
		}
		
		$style = 'ministyle_td_day'; // Weekday
		if (!$other_month && ($day == $today['mday']) && ($m_num == $today['mon']) && ($year == $today['year'])) { // Today
			$style = 'ministyle_td_today';
		}
		else if ($hday != 0) { // Holiday
			$style = 'ministyle_td_sun';
		}
		else if ($wday == 0) { // Sunday 
			$style = 'ministyle_td_sun';
		}
		else if ($wday == 6) { //  Saturday 
			$style = 'ministyle_td_sat';
		}
		
		if (is_page($page)) {
			$link = "<a class=\"small\" href=\"$script?$r_page\" title=\"$s_page\"><strong>$day</strong></a>";
		}
		else {
+			if (empty($user)) {
+				$link = "<span class=\"small\">$day</span>";
+			} else {
				$link = "<a class=\"small\" href=\"$script?cmd=edit&amp;page=$r_page&amp;refer=$r_base\" title=\"$s_page\">$day</a>";
+			}
		}
  • upkさんのコメントを受けて修正してみました。
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
	while (checkdate($m_num,$day,$year)) {
		$dt = sprintf('%4d-%02d-%02d', $year, $m_num, $day);
		$page = $prefix.$dt;
		$r_page = rawurlencode($page);
		$s_page = htmlspecialchars($page);
 
		$h_today = public_holiday($year,$m_num,$day);
		$hday = $h_today['rc'];
		
		if ($wday == 0 and $day > 1) {
			$ret .= "    </tr>\n    <tr>\n";
		}
		
		$style = 'ministyle_td_day'; // Weekday
		if (!$other_month && ($day == $today['mday']) && ($m_num == $today['mon']) && ($year == $today['year'])) { // Today
			$style = 'ministyle_td_today';
		}
		else if ($hday != 0) { // Holiday
			$style = 'ministyle_td_sun';
		}
		else if ($wday == 0) { // Sunday 
			$style = 'ministyle_td_sun';
		}
		else if ($wday == 6) { //  Saturday 
			$style = 'ministyle_td_sat';
		}
		
		if (is_page($page)) {
			$link = "<a class=\"small\" href=\"$script?$r_page\" title=\"$s_page\"><strong>$day</strong></a>";
		}
		else {
+			if (! check_editable($r_page, false, false)) {
+				$link = "<span class=\"small\">$day</span>";
+			} else {
				$link = "<a class=\"small\" href=\"$script?cmd=edit&amp;page=$r_page&amp;refer=$r_base\" title=\"$s_page\">$day</a>";
+			}
		}
  • こっちの方が良いかな
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
+	$user = check_editable(rawurlencode($prefix), false, false);
 
	while (checkdate($m_num,$day,$year)) {
		$dt = sprintf('%4d-%02d-%02d', $year, $m_num, $day);
		$page = $prefix.$dt;
		$r_page = rawurlencode($page);
		$s_page = htmlspecialchars($page);
 
		$h_today = public_holiday($year,$m_num,$day);
		$hday = $h_today['rc'];
		
		if ($wday == 0 and $day > 1) {
			$ret .= "    </tr>\n    <tr>\n";
		}
		
		$style = 'ministyle_td_day'; // Weekday
		if (!$other_month && ($day == $today['mday']) && ($m_num == $today['mon']) && ($year == $today['year'])) { // Today
			$style = 'ministyle_td_today';
		}
		else if ($hday != 0) { // Holiday
			$style = 'ministyle_td_sun';
		}
		else if ($wday == 0) { // Sunday 
			$style = 'ministyle_td_sun';
		}
		else if ($wday == 6) { //  Saturday 
			$style = 'ministyle_td_sat';
		}
		
		if (is_page($page)) {
			$link = "<a class=\"small\" href=\"$script?$r_page\" title=\"$s_page\"><strong>$day</strong></a>";
		}
		else {
+			if (! $user) {
+				$link = "<span class=\"small\">$day</span>";
+			} else {
				$link = "<a class=\"small\" href=\"$script?cmd=edit&amp;page=$r_page&amp;refer=$r_base\" title=\"$s_page\">$day</a>";
+			}
		}

Reload   New Lower page making Edit Freeze Diff Upload Copy Rename   Front page List of pages Search Recent changes Backup Referer   Help   RSS of recent changes