Exemple #1
0
	private function upload() {
		global $config, $upload;

		$a_1 = artist_check($this->object['ub'] . ' x1');
		$a_2 = artist_check($this->object['ub'] . ' gallery');
		$a_3 = artist_check($this->object['ub'] . ' thumbnails');

		if (!$a_1 || !$a_2 || !$a_3) {
			return;
		}

		$filepath = $config['artists_path'] . $this->object['ub'] . '/';
		$filepath_1 = $filepath . 'x1/';
		$filepath_2 = $filepath . 'gallery/';
		$filepath_3 = $filepath . 'thumbnails/';

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

		if (!sizeof($upload->error) && $f !== false) {
			$sql = 'SELECT MAX(image) AS total
				FROM _artists_images
				WHERE ub = ?';
			$img = sql_field(sql_filter($sql, $this->object['ub']), 'total', 0);

			$a = 0;
			foreach ($f as $row) {
				$img++;

				$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(300, 225), false, false);
				$xc = $upload->resize($row, $filepath_2, $filepath_3, $img, array(100, 75), false, false);

				$insert = array(
					'ub' => (int) $this->object['ub'],
					'image' => (int) $img,
					'width' => $xa->width,
					'height' => $xa->height
				);
				sql_insert('artists_images', $insert);

				$a++;
			}

			if ($a) {
				$sql = 'UPDATE _artists SET images = images + ??
					WHERE ub = ?';
				sql_query(sql_filter($sql, $a, $this->object['ub']));
			}

			redirect(s_link('acp', array('artist_gallery', 'a' => $this->object['subdomain'])));
		}

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

		return;
	}
Exemple #2
0
function artist_path($alias, $id, $build = true, $check = false) {
	global $config;

	$response = array($alias{0}, $alias{1}, $id);

	if ($check) {
		artist_check($response);
	}

	if ($build) {
		$response = $config['artists_path'] . artist_build($response) . '/';
	}

	return $response;
}
Exemple #3
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;
	}
Exemple #4
0
	public function _home() {
		global $config, $user, $cache;

		if (!_button()) {
			return false;
		}

		$request = _request(array('name' => '', 'local' => 0, 'location' => '', 'genre' => '', 'email' => '', 'www' => '', 'mods' => ''));
		$request->subdomain = get_subdomain($request->name);

		if (!$request->name) {
			_pre('Ingresa el nombre del artista.', true);
		}

		$sql_insert = array(
			'a_active' => 1,
			'subdomain' => $request->subdomain,
			'name' => $request->name,
			'local' => (int) $request->local,
			'datetime' => time(),
			'location' => $request->location,
			'genre' => $requeset->genre,
			'email' => $request->email,
			'www' => str_replace('http://', '', $request->www)
		);
		$artist_id = sql_insert('artists', $sql_insert);

		// Cache
		$cache->delete('ub_list a_records ai_records a_recent');
		set_config('max_artists', $config['max_artists'] + 1);

		// Create directories
		artist_check($artist_id);

		artist_check($artist_id . ' gallery');
		artist_check($artist_id . ' media');
		artist_check($artist_id . ' thumbnails');
		artist_check($artist_id . ' x1');

		// Mods
		if (!empty($request->mods)) {
			$usernames = w();

			$a_mods = explode(nr(), $request->mods);
			foreach ($a_mods as $each) {
				$username_base = get_username_base($each);

				$sql = 'SELECT *
					FROM _members
					WHERE username_base = ?
						AND user_type <> ?
						AND user_id <> ?';
				if (!$userdata = sql_fieldrow(sql_filter($sql, $username_base, USER_INACTIVE, 1))) {
					continue;
				}

				$sql_insert = array(
					'ub' => $artist_id,
					'user_id' => $userdata['user_id']
				);
				sql_insert('artists_auth', $sql_insert);

				//
				$update = array('user_type' => USER_ARTIST, 'user_auth_control' => 1);

				if (!$userdata['user_rank']) {
					$update['user_rank'] = (int) $config['default_a_rank'];
				}

				$sql = 'UPDATE _members SET ??
					WHERE user_id = ?
						AND user_type NOT IN (??, ??)';
				sql_query(sql_filter($sql, sql_build('UPDATE', $update), $userdata['user_id'], USER_INACTIVE, USER_FOUNDER));
			}

			redirect(s_link('a', $subdomain));
		}
	}