function execute(&$request) { global $_QUERYPARAMS, $_USERGROUPS; k4_bread_crumbs($request['template'], $request['dba'], 'L_CALENDAR'); # get the year month and day from request vars $year = isset($_REQUEST['y']) && intval($_REQUEST['y']) > 0 ? $_REQUEST['y'] : date('Y', time()); $month = isset($_REQUEST['m']) && intval($_REQUEST['m']) > 0 ? $_REQUEST['m'] : date('n', time()); $day = isset($_REQUEST['d']) && intval($_REQUEST['d']) > 0 ? $_REQUEST['j'] : 1; # new k4Calendar instance $c =& new K4Calendar($year, $month, $day); # The next and previous months, do this all first. $year = $month == 1 ? $year - 1 : $year; $html = $this->mini_month($c->getPrevMonth(), $year, $request); $request['template']->setVar('prev_month_cal', $html); $year = $month == 12 ? $year + 1 : $year; $html = $this->mini_month($c->getNextMonth(), $year, $request); $request['template']->setVar('next_month_cal', $html); # Get user birthdays $birthdays = $request['dba']->executeQuery("SELECT {$_QUERYPARAMS['user']}{$_QUERYPARAMS['userinfo']} FROM " . K4USERS . " u LEFT JOIN " . K4USERINFO . " ui ON u.id=ui.user_id WHERE ui.birthday LIKE '" . str_pad($month, 2, '0', STR_PAD_LEFT) . "/%'"); $bdays = array(); if ($birthdays->hasNext()) { while ($birthdays->next()) { $user = $birthdays->current(); $parts = explode("/", $user['birthday']); $group = get_user_max_group($user, $_USERGROUPS); $user['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color']; $user['age'] = $year - intval($parts[2]); $user['U_MEMBERURL'] = K4Url::getMemberUrl($user['id']); $bdays[$parts[1]][] = $user; } } # Add the iterator to the template $c->month = $month; $c->year = $year; $iteration_c = new K4CalendarIterator($c->getData(), $c->getWeek($month, $day, $year), $bdays); $iteration_d = new FAArrayIterator($c->getWeekdays()); //print_r($c->getWeekRange($month, $day, $year)); exit; $request['template']->setList('calendar', $iteration_c); $request['template']->setList('weekdays', $iteration_d); # url's, need fixing $request['template']->setVarArray(array('U_CALENDARPREVYEARURL' => K4Url::getGenUrl('calendar', 'y=' . $c->getPrevYear() . '&m=' . $c->getMonth()), 'U_CALENDARNEXTYEARURL' => K4Url::getGenUrl('calendar', 'y=' . $c->getNextYear() . '&m=' . $c->getMonth()), 'U_CALENDARPREVMONTHURL' => K4Url::getGenUrl('calendar', 'y=' . $c->getYear() . '&m=' . $c->getPrevMonth()), 'U_CALENDARNEXTMONTHURL' => K4Url::getGenUrl('calendar', 'y=' . $c->getYear() . '&m=' . $c->getNextMonth()))); # The rest $request['template']->setVar('month_label', date('F', mktime(0, 0, 0, $c->getMonth(), 1, $c->getYear()))); $request['template']->setVar('year_label', $c->getYear()); $request['template']->setVar('month_next', $c->getNextMonth()); $request['template']->setVar('month_prev', $c->getPrevMonth()); $request['template']->setVar('year_next', $c->getNextYear()); $request['template']->setVar('year_prev', $c->getPrevYear()); $request['template']->setVar('nav_prev', $c->checkPrevYear()); $request['template']->setVar('nav_next', $c->checkNextYear()); $request['template']->setFile('content', 'calendar_index.html'); }
function current() { $temp = parent::current(); if ($temp['invisible'] == 1) { Globals::setGlobal('num_online_invisible', Globals::getGlobal('num_online_invisible') + 1); } if ($temp['user_id'] >= 0) { $group = get_user_max_group($temp, $this->groups); $temp['color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color']; $temp['font_weight'] = @$group['min_perm'] > MEMBER ? 'bold' : 'normal'; } /* Should we free the result? */ if (!$this->hasNext()) { $this->result->free(); } $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['user_id']); //if($temp['name'] != '') { // if(((isset($temp['invisible']) && $temp['invisible'] == 0) || !isset($temp['invisible']))) { return $temp; // } //} }
function current() { $temp = parent::current(); $group = get_user_max_group($temp, $this->groups); $temp['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color']; $temp['group_nicename'] = $group['nicename']; $temp['group_avatar'] = $group['avatar']; $temp['online'] = time() - ini_get('session.gc_maxlifetime') > $temp['seen'] ? 'offline' : 'online'; // custom url's $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['user_id']); /* Should we free the result? */ if (!$this->hasNext()) { $this->result->free(); } return $temp; }
function current() { $temp = parent::current(); $temp['posticon'] = @$temp['posticon'] != '' ? file_exists(BB_BASE_DIR . '/tmp/upload/posticons/' . @$temp['posticon']) ? @$temp['posticon'] : 'clear.gif' : 'clear.gif'; $temp['post_id'] = 't' . $temp['post_id']; if ($temp['poster_id'] > 0) { $temp['post_display_user_ddmenu'] = 1; if (!isset($this->users[$temp['poster_id']])) { $user = $this->dba->getRow("SELECT " . $this->qp['user'] . $this->qp['userinfo'] . " FROM " . K4USERS . " u LEFT JOIN " . K4USERINFO . " ui ON u.id=ui.user_id WHERE u.id=" . intval($temp['poster_id'])); if (is_array($user) && !empty($user)) { $group = get_user_max_group($user, $this->groups); $user['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color']; $user['group_nicename'] = isset($group['nicename']) ? $group['nicename'] : ''; $user['group_avatar'] = isset($group['avatar']) ? $group['avatar'] : ''; $user['online'] = time() - ini_get('session.gc_maxlifetime') > $user['seen'] ? 'offline' : 'online'; $this->users[$user['id']] = $user; } } else { $user = $this->users[$temp['poster_id']]; } if (is_array($user) && !empty($user)) { if ($user['flag_level'] > 0 && $_SESSION['user']->get('perms') >= MODERATOR) { $temp['post_user_background'] = 'background-color: #FFFF00;'; } foreach ($user as $key => $val) { $temp['post_user_' . $key] = $val; } $temp['profilefields'] =& new FAArrayIterator(get_profile_fields($this->fields, $temp)); $temp['post_user_title'] = $user['user_title']; $temp['post_user_user_title'] = get_user_title($user['user_title'], $user['num_posts']); } if (!isset($temp['post_user_online'])) { $temp['post_user_online'] = 'offline'; } /* This array holds all of the userinfo for users that post to this topic */ $this->users[$user['id']] = $user; } else { $temp['post_user_id'] = 0; $temp['post_user_name'] = $temp['poster_name']; } /* Deal with acronyms */ replace_acronyms($temp['body_text']); /* word censors */ replace_censors($temp['body_text']); replace_censors($temp['name']); /* Do any polls if they exist */ do_post_polls($temp, $this->dba); /* do we have any attachments? */ if (isset($temp['attachments']) && $temp['attachments'] > 0) { $temp['attachment_files'] = new K4AttachmentsIterator($this->dba, $this->user, $temp['post_id'], 0); } // url's $temp['U_TOPICURL'] = K4Url::getTopicUrl($temp['post_id']); $temp['U_POSTURL'] = K4Url::getPostUrl($temp['post_id']); $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['poster_id']); if ($this->sr && $temp['num_replies'] > 0) { $this->result = $this->dba->executeQuery("SELECT * FROM " . K4POSTS . " WHERE parent_id = " . intval($temp['post_id']) . " AND row_type=" . REPLY . " " . ($this->post_id ? "AND post_id = " . $this->post_id : "") . " AND created >= " . 3600 * 24 * intval($temp['daysprune']) . " ORDER BY " . $temp['sortedby'] . " " . $temp['sortorder'] . " LIMIT " . intval($temp['start']) . "," . intval($temp['postsperpage'])); $temp['replies'] = new RepliesIterator($this->user, $this->dba, $this->result, $this->qp, $this->users, $this->groups, $this->fields); } return $temp; }
function current() { $temp = parent::current(); $group = get_user_max_group($temp, $this->groups); $temp['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color']; $temp['group_nicename'] = $group['nicename']; $temp['group_avatar'] = $group['avatar']; $temp['font_weight'] = isset($group['min_perm']) && $group['min_perm'] > MEMBER ? 'bold' : 'normal'; $temp['warn_color'] = get_warning_color($temp['warn_level']); // urls $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['user_id']); if (!$this->hasNext()) { $this->result->free(); } return $temp; }
function current() { $temp = parent::current(); /* Cache this forum in the session */ cache_forum($temp); /** * Do the icon */ switch ($temp['row_type']) { case FORUM: $temp['forum_icon'] = 'forum_off'; forum_icon($temp, $temp['forum_icon']); break; case GALLERY: $temp['forum_icon'] = 'forum_gallery'; break; case METAFORUM: $temp['forum_icon'] = 'forum_meta'; break; case ARCHIVEFORUM: $temp['forum_icon'] = 'forum_archive'; break; } /* Set a nice representation of what level we're on */ $temp['level'] = @str_repeat(' ', $this->level); /* Should we query down to the next level of forums? */ if ($temp['row_type'] & CATEGORY) { $temp['forums'] =& new K4ForumsIterator($this->dba, "SELECT * FROM " . K4FORUMS . " WHERE parent_id = " . $temp['forum_id'] . " ORDER BY row_order ASC", TRUE, $this->level + 1); } if ($this->do_recurse) { if ($temp['subforums'] > 0 && $this->settings['showsubforums'] == 1) { $it = new K4ForumsIterator($this->dba, "SELECT * FROM " . K4FORUMS . " WHERE parent_id = " . intval($temp['forum_id']) . " ORDER BY row_order ASC", FALSE, $this->level + 1); if ($it->hasNext()) { // add the iterator $temp['subforums_list'] = $it; } else { // if this forum doesn't actually have subforums, fix it $this->dba->executeUpdate("UPDATE " . K4FORUMS . " SET subforums=0 WHERE forum_id = " . intval($temp['forum_id'])); } } } /** * Get the moderators */ $temp['moderators'] = array(); $temp['are_moderators'] = 0; if ($temp['moderating_groups'] != '') { $groups = explode('|', $temp['moderating_groups']); if (is_array($groups)) { foreach ($groups as $g) { if (isset($this->usergroups[$g])) { $temp['U_USERGROUPURL'] = K4Url::getUserGroupUrl($g); $temp['moderators'][] = $this->usergroups[$g]; } } $temp['are_moderators'] = 1; } } if ($temp['moderating_users'] != '') { $users = force_unserialize($temp['moderating_users']); if (is_array($users) && !empty($users)) { foreach ($users as $user_id => $username) { $temp['U_GMEMBERURL'] = K4Url::getMemberUrl($user_id); $temp['moderators'][] = array('user_id' => $user_id, 'name' => $username); } $temp['are_moderators'] = 1; } } $temp['moderators'] =& new FAArrayIterator($temp['moderators']); /* Replace topic/post names with censors */ replace_censors($temp['topic_name']); replace_censors($temp['post_name']); $temp['topics'] = number_format($temp['topics']); $temp['replies'] = number_format($temp['replies']); $temp['posts'] = number_format($temp['posts']); // /* Set cookies for all of the topics */ // bb_settopic_cache_item('forums', serialize($this->forums), time() + 3600 * 25 * 5); $temp['safe_description'] = strip_tags($temp['description']); $temp['forum'] = $temp['row_type'] == CATEGORY ? 0 : 1; // custom url's $temp['U_FORUMURL'] = K4Url::getForumUrl($temp['forum_id']); $temp['U_TOPICURL'] = K4Url::getTopicUrl($temp['post_id']); $temp['U_POSTURL'] = K4Url::getPostUrl($temp['post_id']); $temp['U_FINDPOSTURL'] = K4Url::getPostUrl($temp['post_id']); $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['post_uid']); $temp['U_REDIRECTURL'] = K4Url::getRedirectUrl($temp['forum_id']); /* Return the formatted forum info */ return $temp; }
function current() { $temp = parent::current(); $temp['posticon'] = isset($temp['posticon']) && @$temp['posticon'] != '' ? file_exists(BB_BASE_DIR . '/tmp/upload/posticons/' . @$temp['posticon']) ? @$temp['posticon'] : 'clear.gif' : 'clear.gif'; if ($temp['poster_id'] > 0) { if (!isset($this->users[$temp['poster_id']])) { $temp['post_display_user_ddmenu'] = 1; // display a ddmenu $user = $this->dba->getRow("SELECT " . $this->qp['user'] . $this->qp['userinfo'] . " FROM " . K4USERS . " u LEFT JOIN " . K4USERINFO . " ui ON u.id=ui.user_id WHERE u.id=" . intval($temp['poster_id'])); if (is_array($user) && !empty($user)) { $group = get_user_max_group($user, $this->groups); $user['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color']; $user['group_nicename'] = $group['nicename']; $user['group_avatar'] = $group['avatar']; $user['online'] = time() - ini_get('session.gc_maxlifetime') > $user['seen'] ? 'offline' : 'online'; $this->users[$user['id']] = $user; } } else { $temp['post_display_user_ddmenu'] = $this->result->hasPrev() ? 0 : 1; // use a different ddmenu $user = $this->users[$temp['poster_id']]; } if (is_array($user) && !empty($user)) { if ($user['flag_level'] > 0 && $_SESSION['user']->get('perms') >= MODERATOR) { $temp['post_user_background'] = 'background-color: #FFFF00;'; } foreach ($user as $key => $val) { $temp['post_user_' . $key] = $val; } $temp['profilefields'] = new FAArrayIterator(get_profile_fields($this->fields, $temp)); $temp['post_user_title'] = $user['user_title']; $temp['post_user_user_title'] = get_user_title($user['user_title'], $user['num_posts']); } if (!isset($temp['post_user_online'])) { $temp['post_user_online'] = 'offline'; } } else { $temp['post_user_id'] = 0; $temp['post_user_name'] = $temp['poster_name']; } /* do we have any attachments? */ if (isset($temp['attachments']) && $temp['attachments'] > 0) { $temp['attachment_files'] = new K4AttachmentsIterator($this->dba, $this->user, $temp['post_id']); } /* Deal with acronyms */ replace_acronyms($temp['body_text']); /* word censors!! */ replace_censors($temp['body_text']); replace_censors($temp['name']); /* Do any polls if they exist */ do_post_polls($temp, $this->dba); // url's $temp['U_TOPICURL'] = K4Url::getTopicUrl($temp['post_id']); $temp['U_POSTURL'] = K4Url::getPostUrl($temp['post_id']); $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['poster_id']); return $temp; }