function validate_id($link_id) { global $xoopsDB, $xoopsConfig, $xoopsUser; $eventcomment_id = intval($link_id); $mydirname = $this->mydirname; if (!preg_match('/^(\\D+)(\\d*)$/', $mydirname, $regs)) { die('Invalid mydirname'); } $mydirnumber = $regs[2] === '' ? '' : intval($regs[2]); $table_event = $xoopsDB->prefix("pical{$mydirnumber}_event"); $MOD_PATH = XOOPS_ROOT_PATH . '/modules/' . $mydirname; if (!class_exists('piCal_xoops')) { require_once $MOD_PATH . '/class/piCal.php'; require_once $MOD_PATH . '/class/piCal_xoops.php'; } $cal = new piCal_xoops('', $xoopsConfig['language'], true); include $MOD_PATH . '/include/read_configs.php'; $whr_categories = $cal->get_where_about_categories(); $whr_class = $cal->get_where_about_class(); list($count) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM {$table_event} WHERE id={$eventcomment_id} AND admission > 0 AND ({$whr_categories}) AND ({$whr_class})")); if ($count <= 0) { return false; } else { return $eventcomment_id; } }
// options $options = explode('|', $plugin['options']); // options[0] : category extract if (!empty($options[0])) { $cids = explode(',', $options[0]); $whr_cid_limit = '0'; foreach ($cids as $cid) { $whr_cid_limit .= " OR categories LIKE '%" . sprintf("%05d,", intval($cid)) . "%'"; } } else { $whr_cid_limit = '1'; } // カテゴリー関連のWHERE条件取得 $whr_categories = $cal->get_where_about_categories(); // CLASS関連のWHERE条件取得 $whr_class = $cal->get_where_about_class(); // 範囲の取得 $range_start_s = mktime(0, 0, 0, $this->month, 0, $this->year); $range_end_s = mktime(0, 0, 0, $this->month + 1, 1, $this->year); // 全日イベント以外の処理 $result = mysql_query("SELECT summary,id,start FROM {$cal->table} WHERE admission > 0 AND start >= {$range_start_s} AND start < {$range_end_s} AND ({$whr_categories}) AND ({$whr_class}) AND ({$whr_cid_limit}) AND allday <= 0", $this->conn); while (list($title, $id, $server_time) = $db->fetchRow($result)) { $user_time = $server_time + $tzoffset_s2u; if (date('n', $user_time) != $this->month) { continue; } $target_date = date('j', $user_time); $tmp_array = array('dotgif' => $plugin['dotgif'], 'dirname' => $plugin['dirname'], 'link' => XOOPS_URL . "/modules/{$plugin['dirname']}/index.php?smode=Daily&caldate={$this->year}-{$this->month}-{$target_date}", 'id' => $id, 'server_time' => $server_time, 'user_time' => $user_time, 'name' => 'id', 'title' => $this->text_sanitizer_for_show($title)); if ($just1gif) { // just 1 gif per a plugin & per a day $plugin_returns[$target_date][$plugin['dirname']] = $tmp_array;