Initial commit
This commit is contained in:
		
							
								
								
									
										29
									
								
								includes/main/entries.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								includes/main/entries.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| <?php | ||||
|  | ||||
| addTitle($_locale['entries']); | ||||
|  | ||||
| if (isset($seo[1]) && isnum($seo[1])) | ||||
| 	$blog = new blog(null, $seo[1]); | ||||
| else | ||||
| 	$blog = new blog(); | ||||
|  | ||||
| if (theme_component('entries')) | ||||
| 	include theme_component('entries'); | ||||
| else | ||||
| { | ||||
| 	if (LOGGEDIN && $user['userLevel'] > 2) echo "<a href='/admin/entry'><p class='phantom'>{locale:new_entry}</p></a>"; | ||||
| 	if ($blog->entries) | ||||
| 	{ | ||||
| 		while ($data = $blog->entries()) | ||||
| 			echo "<article> | ||||
| 					<header> | ||||
| 						<h2><a href='".get_entry_link($data['entrySlug'])."'>".htmlspecialchars($data['entryTitle'])."</a></h2> | ||||
| 						<p class='meta'><time class='date' title='{locale:published_on}'>".show_date($data['entryPublished'])."</time><a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}'>$data[publicName]</a>".get_entry_admin($data)."</p> | ||||
| 					</header> | ||||
| 					<div class='content'>".entry_show_init($data['entryContent'], $data['entrySlug'])."</div> | ||||
| 				</article>\n"; | ||||
| 		echo "<p class='paginator'>".(isset($seo[1]) && isnum($seo[1]) ? "<a href='/p/".($seo[1]+1)."'>{locale:next_page}</a><a href='/p/".($seo[1]-1)."'>{locale:prev_page}</a>" : "<a href='/p/2'>{locale:next_page}</a>")."</p>"; | ||||
| 	} else | ||||
| 		echo "<h1>{locale:entry_not_found_title}</h1>" | ||||
| 			."<p>{locale:entry_not_found}</p>\n"; | ||||
| } | ||||
							
								
								
									
										37
									
								
								includes/main/entry.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								includes/main/entry.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| <?php | ||||
|  | ||||
| if (!isset($seo[1])) redirect(); | ||||
|  | ||||
| $blog = new blog($seo[1]); | ||||
|  | ||||
| if (theme_component('entry')) | ||||
| 	include theme_component('entry'); | ||||
| else | ||||
| 	if ($blog->entries) | ||||
| 		while ($data = $blog->entry()) | ||||
| 		{ | ||||
| 			addTitle($data['entryTitle']); | ||||
|  | ||||
| 			if ($data['entryHidden']) echo "<p>{locale:hidden_content}</p>"; | ||||
|  | ||||
| 			if ($data['entryPIN'] && get_pin() != $data['entryPIN']) | ||||
| 				echo "<p>{locale:pin_protected_content}</p> | ||||
| 				<form action='".get_entry_link($data['entrySlug'])."' method='post' name='entry-pin-input'> | ||||
| 					<input type='text' name='read_entry_pin' placeholder='{locale:entry_pin}' /> | ||||
| 					<button type='submit'>{locale:unlock}</button> | ||||
| 				</form>"; | ||||
| 			else | ||||
| 			{ | ||||
| 				addDescription(entry_show_init($data['entryContent'], $data['entrySlug'])); | ||||
| 				addImage((preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $data['entryContent'], $images) ? $images[1] : 0)); | ||||
| 				headerImage($data['entryHeader']); | ||||
| 				echo "<article class='full'> | ||||
| 						<h2>".htmlspecialchars($data['entryTitle'])."</h2> | ||||
| 						<div class='content'>".entry_show_all($data['entryContent'])."</div> | ||||
| 						<p class='meta'><time class='date' title='{locale:published_on}'>".show_date($data['entryPublished'])."</time><a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}'>$data[publicName]</a>".get_entry_admin($data)."</p> | ||||
| 					</article>\n"; | ||||
| 			} | ||||
| 		} | ||||
| 	else | ||||
| 		echo "<h1>{locale:entry_not_found_title}</h1>" | ||||
| 			."<p>{locale:entry_not_found}</p>\n"; | ||||
							
								
								
									
										38
									
								
								includes/main/login.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								includes/main/login.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| <?php | ||||
|  | ||||
| if (LOGGEDIN) redirect(get_profile_link()); | ||||
|  | ||||
| addTitle($_locale['login']); | ||||
|  | ||||
| if (theme_component('login')) : | ||||
| 	include theme_component('login'); | ||||
| else : | ||||
| ?> | ||||
|  | ||||
| <div style="float: left; width: 48%;"> | ||||
| 	<h1>{locale:login}</h1> | ||||
| 	<form action="<?=get_current_link()?>" method="post" name="login-form"> | ||||
|  | ||||
| 		<input type="text" name="login_name" value="" /> | ||||
| 		<input type="password" name="login_pass" value="" /> | ||||
|  | ||||
| 		<button type="submit">{locale:login}</button> | ||||
|  | ||||
| 	</form> | ||||
| </div> | ||||
| <div style="float: right; width: 48%;"> | ||||
| 	<h1>{locale:registration}</h1> | ||||
| 	<form action="<?=get_current_link()?>" method="post" name="registration-form"> | ||||
|  | ||||
| 		<input type="text" name="reg_name" value="" placeholder="{locale:username}" autocomplete="off" /> | ||||
| 		<input type="password" name="reg_pass" value="" placeholder="{locale:password}" autocomplete="off" /> | ||||
| 		<input type="password" name="reg_pass2" value="" placeholder="{locale:password_again}" autocomplete="off" /> | ||||
| 		<input type="text" name="reg_email" value="" placeholder="{locale:email}" autocomplete="off" /> | ||||
|  | ||||
| 		<button type="submit">{locale:registration}</button> | ||||
|  | ||||
| 	</form> | ||||
| </div> | ||||
| <div class="clear"></div> | ||||
|  | ||||
| <?php endif ?> | ||||
							
								
								
									
										16
									
								
								includes/main/page.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								includes/main/page.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <?php | ||||
|  | ||||
| if (!isset($seo[1])) redirect(); | ||||
|  | ||||
| $page = new page($seo[1]); | ||||
|  | ||||
| if (theme_component('page')) | ||||
| 	include theme_component('page'); | ||||
| else | ||||
| 	if ($page->readable()) | ||||
| 	{ | ||||
| 		addTitle($page->data['pageTitle']); | ||||
|  | ||||
| 		echo "<h1>".htmlspecialchars($page->data['pageTitle'])."</h1>"; | ||||
| 		echo entry_show_all($page->data['pageContent']); | ||||
| 	} | ||||
							
								
								
									
										126
									
								
								includes/main/profile.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								includes/main/profile.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,126 @@ | ||||
| <?php | ||||
|  | ||||
| $profile = new user($seo[1], null, null, true); | ||||
| if ($profile) : | ||||
| 	$userData = $profile->get_data(); | ||||
| 	$me = (LOGGEDIN && $user['userId'] == $userData['userId'] ? true : false); | ||||
| endif; | ||||
|  | ||||
| if ($me) | ||||
| { | ||||
|  | ||||
| 	if (isset($_POST["userEdit"])) | ||||
| 	{ | ||||
| 		$name	= $_POST['userPublicName'];		if (!Check::name($name))						array_push($error, $_locale['edit_wrong_public_name']); | ||||
| 		$rname	= $_POST['userRealName'];		if (!Check::name($rname))						array_push($error, $_locale['edit_wrong_real_name']); | ||||
| 		$email	= $_POST['userEmail'];			if (strlen($email) && !Check::email($email))	array_push($error, $_locale['edit_wrong_email']); | ||||
| 		$web	= $_POST['userWeb'];			if (!Check::domain($web))						array_push($error, $_locale['edit_wrong_web']); | ||||
| 		$bio	= htmlspecialchars($_POST['userIntroduction']);	if (strlen($bio) > 200)			array_push($error, $_locale['edit_wrong_introduction']); | ||||
|  | ||||
| 		$bio = sqlprot($bio); | ||||
|  | ||||
| 		if (empty($error)) | ||||
| 			if ($_sql->query("UPDATE users SET userPublicName = '$name',userRealName = '$rname',userEmail = '$email',userWeb = '$web',userIntroduction = '$bio' WHERE userId = $user[userId]")) | ||||
| 				redirect(get_profile_link()); | ||||
| 			else | ||||
| 				array_push($error, $_locale['profile_not_updated']); | ||||
| 	} | ||||
|  | ||||
| 	if (isset($_FILES["userPic"])) | ||||
| 	{ | ||||
| 		$file = 'data/profile_pics/'.$user['userId'].'.jpg'; | ||||
| 		if (file_exists($file)) unlink($file); | ||||
| 		if ($_FILES["userPic"]["error"] < 1 && in_array($_FILES["userPic"]["type"], explode(',', $_set['allowedPicTypes']))) | ||||
| 		{ | ||||
| 			clear_cache(); | ||||
|  | ||||
| 			$thumb = new Imagick($_FILES["userPic"]["tmp_name"]); | ||||
| 			//$thumb->resizeImage(500, 500, Imagick::FILTER_POINT, 1, true); | ||||
| 			$thumb->cropThumbnailImage(500, 500); | ||||
| 			$thumb->setImageFormat('jpg'); | ||||
| 			$thumb->writeImage($file); | ||||
| 			$thumb->destroy();  | ||||
|  | ||||
| 			$profile->setPic(true); | ||||
|  | ||||
| 			redirect(get_current_link()); | ||||
| 		} else | ||||
| 		{ | ||||
| 			$profile->setPic(false); | ||||
| 		} | ||||
| 	} else | ||||
| 	{ | ||||
| 		//$profile->setPic(false); | ||||
| 		//redirect(get_current_link()); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| if (isset($seo[2]) && $seo[2] == 'edit') | ||||
| { | ||||
| 	addTitle($_locale['profile_edit']); | ||||
| 	if (theme_component('profile_edit')) | ||||
| 		include theme_component('profile_edit'); | ||||
| 	else | ||||
| 		include 'includes/main/profile_edit.php'; | ||||
| } | ||||
| else | ||||
| { | ||||
| 	addTitle($userData['userPublicName'].$_locale['s_profile']); | ||||
|  | ||||
| if (theme_component('profile')) : | ||||
| 	include theme_component('profile'); | ||||
| else : | ||||
| 	if ($profile) : | ||||
| ?> | ||||
| 	<div class="profile pic"> | ||||
| 		<div id="profile_pic" style="background-image: url('<?=get_profile_picture($userData)?>')"> | ||||
| 		<?php if ($me) : ?> | ||||
| 			<form action="<?=get_current_link()?>" method="post" name="userpic-upload" enctype="multipart/form-data"> | ||||
| 				<input type="file" name="userPic" id="userPicInput" style="display: none" /> | ||||
| 				<button type="button" onclick="$('#userPicInput').focus().click()">{locale:browse}</button><button type="submit" id="userPicSaveBtn" class="orange">{locale:delete}</button> | ||||
| 			</form> | ||||
| 			<script> | ||||
| 				$("#userPicInput").change(function() { | ||||
| 					$("#userPicSaveBtn").html('{locale:save}').removeClass('orange'); | ||||
| 				}); | ||||
| 			</script> | ||||
| 		<?php endif ?> | ||||
| 		</div> | ||||
| 	</div> | ||||
| 	<div class="profile details"> | ||||
| 		<h1><?=$userData['userPublicName'].$_locale['s_profile']?></h1> | ||||
| 		<h3><?=$userData['userName'].($me ? ' <a href="'.get_current_link().'/edit" class="edit">{locale:profile_edit}</a>' : '')?></h3> | ||||
|  | ||||
| 		<?php if (LOGGEDIN) : ?> | ||||
| 		<div class='box contact'> | ||||
| 			<p><strong>{locale:name}:</strong> <?=$userData['userRealName']?></p> | ||||
| 			<p><strong>{locale:email}:</strong> <?=$userData['userEmail']?></p> | ||||
| 			<p><strong>{locale:web}:</strong> <?=$userData['userWeb']?></p> | ||||
| 		</div> | ||||
| 		<div class='spacer'></div> | ||||
| 		<?php endif ?> | ||||
|  | ||||
| 		<?php | ||||
| 		$recent = $_sql->query("SELECT entrySlug, entryTitle FROM entries WHERE entryBy = $userData[userId] AND entryPublished <= ".time()." ORDER BY entryPublished DESC LIMIT 5"); | ||||
| 		if ($recent->num_rows) : ?> | ||||
| 		<div class='box recent'> | ||||
| 			<?php | ||||
| 			while ($data = $recent->fetch_assoc()) | ||||
| 				echo "<p><a href='".get_entry_link($data['entrySlug'])."'>".trimlink($data['entryTitle'], 42)."</a></p>\n"; | ||||
| 			?> | ||||
| 		</div> | ||||
| 		<?php endif; unset($recent); ?> | ||||
|  | ||||
| 		<?php if ($userData['userIntroduction']) : ?> | ||||
| 		<div class='box introduction'> | ||||
| 			<p><?=$userData['userIntroduction']?></p> | ||||
| 		</div> | ||||
| 		<?php endif ?> | ||||
|  | ||||
| 		<div class="clear"></div> | ||||
| 	</div> | ||||
| 	<div class="clear"></div> | ||||
| <?php else : ?> | ||||
| 	<h1>{locale:profile}</h1> | ||||
| 	<p>{locale:profile_not_found}</p> | ||||
| <?php endif; endif; } ?> | ||||
							
								
								
									
										17
									
								
								includes/main/profile_edit.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								includes/main/profile_edit.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| <h1>{locale:profile_edit}: <?=$userData['userPublicName']?></h1> | ||||
|  | ||||
| <form action="<?=get_current_link()?>" method="post" name="edit-profile"> | ||||
|  | ||||
| <h3>{locale:contact}</h3> | ||||
| <input type="text" name="userPublicName" value="<?=$userData['userPublicName']?>" placeholder="{locale:public_name}" maxlength="50" /> | ||||
| <input type="text" name="userRealName" value="<?=$userData['userRealName']?>" placeholder="{locale:name}" maxlength="50" /> | ||||
| <input type="text" name="userEmail" value="<?=$userData['userEmail']?>" placeholder="{locale:email}" maxlength="50" /> | ||||
| <input type="text" name="userWeb" value="<?=$userData['userWeb']?>" placeholder="{locale:web}" maxlength="50" /> | ||||
|  | ||||
|  | ||||
| <h3>{locale:introduction}</h3> | ||||
| <textarea name="userIntroduction" maxlength="320"><?=htmlentities($userData['userIntroduction'])?></textarea> | ||||
|  | ||||
| <button type="submit" name="userEdit">{locale:save}</button> | ||||
|  | ||||
| </form> | ||||
							
								
								
									
										29
									
								
								includes/main/tag.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								includes/main/tag.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| <?php | ||||
|  | ||||
| if (!isset($seo[1]) || !is_numeric($seo[1])) redirect(); | ||||
|  | ||||
| $tagged = $_sql->query("SELECT tagName FROM tags WHERE tagId = $seo[1]"); | ||||
| $entries = $_sql->query("SELECT entrySlug, entryTitle, entryPublished, entryBy FROM entries INNER JOIN tagged ON taggedEntry = entryId WHERE taggedTag = $seo[1] AND entryHidden IS NULL ORDER BY entryPublished DESC"); | ||||
|  | ||||
| if (theme_component('tag')) | ||||
| 	include theme_component('tag'); | ||||
| else | ||||
| { | ||||
| 	if ($tagged->num_rows) | ||||
| 	{ | ||||
| 		$tag = $tagged->fetch_assoc(); | ||||
| 		addTitle($tag['tagName']); | ||||
| 		echo "<h1>$tag[tagName]</h1>"; | ||||
| 		if ($entries->num_rows) | ||||
| 		{ | ||||
| 			echo "<ul>"; | ||||
| 			while ($data = $entries->fetch_assoc()) | ||||
| 				echo "<li><a href='".get_entry_link($data['entrySlug'])."'>$data[entryTitle]</a></li>"; | ||||
| 			echo "</ul>"; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| unset($tag); | ||||
| unset($tagged); | ||||
| unset($entries); | ||||
		Reference in New Issue
	
	Block a user