예제 #1
0
파일: mon_prec.php 프로젝트: muthulatha/iem
    }); // run once

});
</script>
';
reset($data);
function friendly($val)
{
    if ($val == null) {
        return "M";
    }
    return sprintf("%.2f", $val);
}
$table = "";
while (list($key, $val) = each($data)) {
    $table .= sprintf("<tr><td>%s</td><td>%s</td>\n  <td>%s</td><td>%s</td><td>%s</td>\n  <td>%s</td><td>%s</td><td>%s</td>\n  <td>%s</td><td>%s</td><td>%s</td>\n  <td>%s</td><td>%s</td><td>%s</td>\n  <td>%.2f</td><td>%.2f</td>\n  </tr>", $key, $cities[$key]["name"], friendly($val[0]), friendly($val[1]), friendly($val[2]), friendly($val[3]), friendly($val[4]), friendly($val[5]), friendly($val[6]), friendly($val[7]), friendly($val[8]), friendly($val[9]), friendly($val[10]), friendly($val[11]), array_sum(array_slice($val, 4, 4)), array_sum($val));
}
$d = date("d M Y h a");
$t->content = <<<EOF
<ol class="breadcrumb">
\t<li><a href="/AWOS/">AWOS Mainpage</a></li>
\t<li>{$year} Iowa AWOS Precipitation Report</li>
</ol>

<p>This table was generated at {$d} and is based
on available AWOS data.  
<strong>No attempt was made to estimate missing data.</strong></p>

<form name="change">
<p>{$yselect}
<input type="submit" value="Change Year" />
예제 #2
0
	private function upload() {
		global $config, $user, $cache, $upload;

		$limit = set_time_limit(0);

		$filepath = $config['artists_path'] . $this->object['ub'] . '/';
		$filepath_1 = $filepath . 'media/';

		$f = (artist_check($this->object['ub'] . ' media') !== false) ? $upload->process($filepath_1, 'create', 'mp3') : false;

		if ($f === false) {
			return;
		} else if (!sizeof($upload->error)) {
			$a = sql_total('_dl');

			foreach ($f as $i => $row) {
				if (!$i) {
					require_once(ROOT . 'interfase/getid3/getid3.php');
					$getID3 = new getID3;
				}

				$filename = $upload->rename($row, $a);
				$tags = $getID3->analyze($filename);
				$a++;

				$mt = new stdClass();
				foreach (w('title genre album year') as $w) {
					$mt->$w = (isset($tags['tags']['id3v1'][$w][0])) ? htmlencode($tags['tags']['id3v1'][$w][0]) : '';
				}

				$sql_insert = array(
					'ud' => 1,
					'ub' => $this->object['ub'],
					'alias' => friendly($mt->title),
					'title' => $mt->title,
					'views' => 0,
					'downloads' => 0,
					'votes' => 0,
					'posts' => 0,
					'date' => time(),
					'filesize' => @filesize($filename),
					'duration' => $tags['playtime_string'],
					'genre' => $mt->genre,
					'album' => $mt->album,
					'year' => $mt->year
				);
				$media_id = sql_insert('dl', $sql_insert);
			}

			$sql = 'UPDATE _artists SET um = um + ??
				WHERE ub = ?';
			sql_query(sql_filter($sql, count($f), $a_id));

			$cache->delete('downloads_list');

			redirect(s_link('acp', array('artist_media', 'a' => $this->object['subdomain'], 'id' => $media_id)));
		} else {
			_style('error', array(
				'MESSAGE' => parse_error($upload->error))
			);
		}

		return;
	}
예제 #3
0
	public function _home() {
		global $config, $user, $cache, $upload, $comments;

		if (_button()) {
			$cat_id = request_var('cat_id', 0);
			$post_subject = request_var('post_subject', '');
			$post_desc = request_var('post_desc', '', true);
			$post_message = request_var('post_text', '', true);

			if (empty($post_desc) || empty($post_message)) {
				_pre('Campos requeridos.', true);
			}

			$post_message = $comments->prepare($post_message);
			$post_desc = $comments->prepare($post_desc);
			$news_alias = friendly($post_subject);

			//
			$sql_insert = array(
				'news_fbid' => '',
				'cat_id' => $cat_id,
				'news_active' => 1,
				'news_alias' => $news_alias,
				'post_reply' => 0,
				'post_type' => 0,
				'poster_id' => $user->d('id'),
				'post_subject' => $post_subject,
				'post_text' => $post_message,
				'post_desc' => $post_desc,
				'post_views' => 0,
				'post_replies' => 0,
				'post_time' => time(),
				'post_ip' => $user->ip,
				'image' => 0
			);
			$sql = 'INSERT _news' . sql_build('INSERT', $sql_insert);
			$news_id = sql_query_nextid($sql);

			// Upload news thumbnail

			$send = $upload->process($config['news_path'], 'thumbnail');

			if (count($this->error)) {
				$error = array_merge($error, $this->error);
				return;
			}

			if ($send !== false) {
				foreach ($send as $row) {
					$resize = $upload->resize($row, $config['news_path'], $config['news_path'], $news_id, array(100, 100), false, false, true);
					if ($resize === false) {
						continue;
					}
				}
			}

			$cache->delete('news');
			redirect(s_link('news', $news_alias));
		}

		$sql = 'SELECT cat_id, cat_name
			FROM _news_cat
			ORDER BY cat_order';
		$news_cat = sql_rowset($sql);

		foreach ($news_cat as $i => $row) {
			if (!$i) _style('cat');

			_style('cat.row', array(
				'CAT_ID' => $row['cat_id'],
				'CAT_NAME' => $row['cat_name'])
			);
		}

		return;
	}
예제 #4
0
파일: event.php 프로젝트: nopticon/rockr
	public function _home() {
		global $config, $user, $cache, $upload;

		$error = w();

		if (_button()) {
			$filepath = $config['events_path'];
			$filepath_1 = $filepath . 'future/';
			$filepath_2 = $filepath_1 . 'thumbnails/';

			$f = $upload->process($filepath_1, 'event_image', 'jpg');

			if (!sizeof($upload->error) && $f !== false) {
				$img = sql_total('_events');

				// Create vars
				$event_name = request_var('event_name', '');
				$event_artists = request_var('event_artists', '', true);
				$event_year = request_var('event_year', 0);
				$event_month = request_var('event_month', 0);
				$event_day = request_var('event_day', 0);
				$event_hours = request_var('event_hours', 0);
				$event_minutes = request_var('event_minutes', 0);
				$event_current_topic = request_var('event_current_topic', 0);

				$v_date = gmmktime($event_hours, $event_minutes, 0, $event_month, $event_day, $event_year) - $user->timezone - $user->dst;

				foreach ($f as $row) {
					$xa = $upload->resize($row, $filepath_1, $filepath_1, $img, array(600, 400), false, false, true);
					if ($xa === false) {
						continue;
					}
					$xb = $upload->resize($row, $filepath_1, $filepath_2, $img, array(100, 75), false, false);

					$event_alias = friendly($event_name);

					$insert = array(
						'event_alias' => $event_alias,
						'title' => $event_name,
						'archive' => '',
						'date' => (int) $v_date,
						'event_update' => time()
					);
					$event_id = sql_insert('events', $insert);

					//
					$artists_ary = explode(nr(), $event_artists);
					foreach ($artists_ary as $row) {
						$subdomain = get_subdomain($row);

						$sql = 'SELECT *
							FROM _artists
							WHERE subdomain = ?';
						if ($a_row = sql_fieldrow(sql_filter($sql, $subdomain))) {
							$sql = 'SELECT *
								FROM _artists_events
								WHERE a_artist = ?
									AND a_event = ?';
							if (!sql_fieldrow(sql_filter($sql, $a_row['ub'], $event_id))) {
								$sql_insert = array(
									'a_artist' => $a_row['ub'],
									'a_event' => $event_id
								);
								sql_insert('artists_events', $sql_insert);
							}
						}
					}

					// Alice: Create topic
					$event_url = $config['events_url'] . 'future/' . $img  . '.jpg';

					$post_message = 'Evento publicado';
					$post_time = time();
					$forum_id = 21;
					$poster_id = 1433;

					$sql = 'SELECT *
						FROM _forum_topics
						WHERE topic_id = ?';
					if (!$row_current_topic = sql_fieldrow(sql_filter($sql, $event_current_topic))) {
						$insert = array(
							'topic_title' => $event_name,
							'topic_poster' => $poster_id,
							'topic_time' => $post_time,
							'forum_id' => $forum_id,
							'topic_locked' => 0,
							'topic_announce' => 0,
							'topic_important' => 0,
							'topic_vote' => 1,
							'topic_featured' => 1,
							'topic_points' => 1
						);
						$topic_id = sql_insert('forum_topics', $insert);

						$event_current_topic = 0;
					} else {
						$topic_id = $event_current_topic;

						$post_message .= ' en la secci&oacute;n de eventos';

						$sql = 'UPDATE _forum_topics SET topic_title = ?
							WHERE topic_id = ?';
						sql_query(sql_filter($sql, $event_name, $topic_id));
					}

					$post_message .= '.';

					$insert = array(
						'topic_id' => (int) $topic_id,
						'forum_id' => $forum_id,
						'poster_id' => $poster_id,
						'post_time' => $post_time,
						'poster_ip' => $user->ip,
						'post_text' => $post_message,
						'post_np' => ''
					);
					$post_id = sql_insert('forum_posts', $insert);

					$sql = 'UPDATE _events SET event_topic = ?
						WHERE id = ?';
					sql_query(sql_filter($sql, $topic_id, $event_id));

					$insert = array(
						'topic_id' => (int) $topic_id,
						'vote_text' => '&iquest;Asistir&aacute;s a ' . $event_name . '?',
						'vote_start' => time(),
						'vote_length' => (int) ($poll_length * 86400)
					);
					$poll_id = sql_insert('poll_options', $insert);

					$poll_options = array(1 => 'Si asistir&eacute;');

					foreach ($poll_options as $option_id => $option_text) {
						$sql_insert = array(
							'vote_id' => (int) $poll_id,
							'vote_option_id' => (int) $option_id,
							'vote_option_text' => $option_text,
							'vote_result' => 0
						);
						sql_insert('poll_results', $sql_insert);

						$poll_option_id++;
					}

					$sql = 'UPDATE _forums SET forum_posts = forum_posts + 1, forum_last_topic_id = ?' . ((!$event_current_topic) ? ', forum_topics = forum_topics + 1 ' : '') . '
						WHERE forum_id = ?';
					sql_query(sql_filter($sql, $topic_id, $forum_id));

					$sql = 'UPDATE _forum_topics SET topic_first_post_id = ?, topic_last_post_id = ?
						WHERE topic_id = ?';
					sql_query(sql_filter($sql, $post_id, $post_id, $topic_id));

					$sql = 'UPDATE _members SET user_posts = user_posts + 1
						WHERE user_id = ?';
					sql_query(sql_filter($sql, $poster_id));

					// Notify
					$user->save_unread(UH_T, $topic_id);

					redirect(s_link('events', $event_alias));
				}
			}

			_style('error', array(
				'MESSAGE' => parse_error($upload->error))
			);
		}

		$sql = 'SELECT topic_id, topic_title
			FROM _forum_topics t
			LEFT OUTER JOIN _events e ON t.topic_id = e.event_topic
			WHERE e.event_topic IS NULL
				AND forum_id = 21
			ORDER BY topic_time DESC';
		$topics = sql_rowset($sql);

		foreach ($topics as $i => $row) {
			if (!$i) _style('topics');

			_style('topics.row', array(
				'TOPIC_ID' => $row['topic_id'],
				'TOPIC_TITLE' => $row['topic_title'])
			);
		}

		return;
	}