Forráskód Böngészése

add telegram support #1565

Diego Najar 1 éve
szülő
commit
437190fcbb

+ 173 - 164
bl-kernel/admin/views/edit-user.php

@@ -1,13 +1,13 @@
 <?php defined('BLUDIT') or die('Bludit CMS.'); ?>
 
-<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>
+<?php echo Bootstrap::formOpen(array('id' => 'jsform', 'class' => 'tab-content')); ?>
 
 <div class="align-middle">
 	<div class="float-right mt-1">
 		<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
-		<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
+		<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT . 'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
 	</div>
-	<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Edit user'), 'icon'=>'user')); ?>
+	<?php echo Bootstrap::pageTitle(array('title' => $L->g('Edit user'), 'icon' => 'user')); ?>
 </div>
 
 <!-- TABS -->
@@ -21,81 +21,81 @@
 </nav>
 
 <?php
-	// Token CSRF
-	echo Bootstrap::formInputHidden(array(
-		'name'=>'tokenCSRF',
-		'value'=>$security->getTokenCSRF()
-	));
-
-	// Username
-	echo Bootstrap::formInputHidden(array(
-		'name'=>'username',
-		'value'=>$user->username()
-	));
+// Token CSRF
+echo Bootstrap::formInputHidden(array(
+	'name' => 'tokenCSRF',
+	'value' => $security->getTokenCSRF()
+));
+
+// Username
+echo Bootstrap::formInputHidden(array(
+	'name' => 'username',
+	'value' => $user->username()
+));
 ?>
 
 <div class="tab-content" id="nav-tabContent">
 	<!-- Profile tab -->
 	<div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="nav-profile-tab">
-	<?php
+		<?php
 		// Display username but disable the field
 		echo Bootstrap::formInputText(array(
-			'name'=>'usernameDisabled',
-			'label'=>$L->g('Username'),
-			'value'=>$user->username(),
-			'class'=>'',
-			'placeholder'=>'',
-			'disabled'=>true,
-			'tip'=>''
+			'name' => 'usernameDisabled',
+			'label' => $L->g('Username'),
+			'value' => $user->username(),
+			'class' => '',
+			'placeholder' => '',
+			'disabled' => true,
+			'tip' => ''
 		));
 
-		if ($login->role()==='admin') {
+		if ($login->role() === 'admin') {
 			echo Bootstrap::formSelect(array(
-				'name'=>'role',
-				'label'=>$L->g('Role'),
-				'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
-				'selected'=>$user->role(),
-				'class'=>'',
-				'tip'=>$L->g('author-can-write-and-edit-their-own-content')
+				'name' => 'role',
+				'label' => $L->g('Role'),
+				'options' => array('author' => $L->g('Author'), 'editor' => $L->g('Editor'), 'admin' => $L->g('Administrator')),
+				'selected' => $user->role(),
+				'class' => '',
+				'tip' => $L->g('author-can-write-and-edit-their-own-content')
 			));
 		}
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'email',
-			'label'=>$L->g('Email'),
-			'value'=>$user->email(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'email',
+			'label' => $L->g('Email'),
+			'value' => $user->email(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'nickname',
-			'label'=>$L->g('Nickname'),
-			'value'=>$user->nickname(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>$L->g('The nickname is almost used in the themes to display the author of the content')
+			'name' => 'nickname',
+			'label' => $L->g('Nickname'),
+			'value' => $user->nickname(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => $L->g('The nickname is almost used in the themes to display the author of the content')
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'firstName',
-			'label'=>$L->g('First Name'),
-			'value'=>$user->firstName(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'firstName',
+			'label' => $L->g('First Name'),
+			'value' => $user->firstName(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'lastName',
-			'label'=>$L->g('Last Name'),
-			'value'=>$user->lastName(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'lastName',
+			'label' => $L->g('Last Name'),
+			'value' => $user->lastName(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
-	?>
+		?>
 	</div>
 
 	<!-- Profile picture tab -->
@@ -110,71 +110,71 @@
 					<!-- <button id="jsbuttonRemovePicture" type="button" class="btn btn-primary w-100 mt-4 mb-4"><i class="fa fa-trash"></i> Remove picture</button> -->
 				</div>
 				<div class="col-lg-8 col-sm-12 p-0 text-center">
-					<img id="jsprofilePicturePreview" class="img-fluid img-thumbnail" alt="Profile picture preview" src="<?php echo (Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png?version='.time():HTML_PATH_CORE_IMG.'default.svg') ?>" />
+					<img id="jsprofilePicturePreview" class="img-fluid img-thumbnail" alt="Profile picture preview" src="<?php echo (Sanitize::pathFile(PATH_UPLOADS_PROFILES . $user->username() . '.png') ? DOMAIN_UPLOADS_PROFILES . $user->username() . '.png?version=' . time() : HTML_PATH_CORE_IMG . 'default.svg') ?>" />
 				</div>
 			</div>
 		</div>
 		<script>
-		// $("#jsbuttonRemovePicture").on("click", function() {
-		// 	var username = $("#jsusername").val();
-		// 	bluditAjax.removeProfilePicture(username);
-		// 	$("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG.'default.svg' ?>");
-		// });
-
-		$("#jsprofilePictureInputFile").on("change", function() {
-			var formData = new FormData();
-			formData.append('tokenCSRF', tokenCSRF);
-			formData.append('profilePictureInputFile', $(this)[0].files[0]);
-			formData.append('username', $("#jsusername").val());
-			$.ajax({
-				url: HTML_PATH_ADMIN_ROOT+"ajax/profile-picture-upload",
-				type: "POST",
-				data: formData,
-				cache: false,
-				contentType: false,
-				processData: false
-			}).done(function(data) {
-				if (data.status==0) {
-					$("#jsprofilePicturePreview").attr('src',data.absoluteURL+"?time="+Math.random());
-				} else {
-					showAlert(data.message);
-				}
+			// $("#jsbuttonRemovePicture").on("click", function() {
+			// 	var username = $("#jsusername").val();
+			// 	bluditAjax.removeProfilePicture(username);
+			// 	$("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG . 'default.svg' ?>");
+			// });
+
+			$("#jsprofilePictureInputFile").on("change", function() {
+				var formData = new FormData();
+				formData.append('tokenCSRF', tokenCSRF);
+				formData.append('profilePictureInputFile', $(this)[0].files[0]);
+				formData.append('username', $("#jsusername").val());
+				$.ajax({
+					url: HTML_PATH_ADMIN_ROOT + "ajax/profile-picture-upload",
+					type: "POST",
+					data: formData,
+					cache: false,
+					contentType: false,
+					processData: false
+				}).done(function(data) {
+					if (data.status == 0) {
+						$("#jsprofilePicturePreview").attr('src', data.absoluteURL + "?time=" + Math.random());
+					} else {
+						showAlert(data.message);
+					}
+				});
 			});
-		});
 		</script>
 	</div>
 
 	<!-- Security tab -->
 	<div class="tab-pane fade" id="security" role="tabpanel" aria-labelledby="nav-security-tab">
-	<?php
-		echo Bootstrap::formTitle(array('title'=>$L->g('Password')));
+		<?php
+		echo Bootstrap::formTitle(array('title' => $L->g('Password')));
 
 		echo '
 		<div class="form-group">
-			<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
+			<a href="' . HTML_PATH_ADMIN_ROOT . 'user-password/' . $user->username() . '" class="btn btn-primary mr-2">' . $L->g('Change password') . '</a>
 		</div>
 		';
 
-		echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
+		echo Bootstrap::formTitle(array('title' => $L->g('Authentication Token')));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'tokenAuth',
-			'label'=>$L->g('Token'),
-			'value'=>$user->tokenAuth(),
-			'class'=>'',
-			'tip'=>$L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
+			'name' => 'tokenAuth',
+			'label' => $L->g('Token'),
+			'value' => $user->tokenAuth(),
+			'class' => '',
+			'tip' => $L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
 		));
 
-		if (checkRole(array('admin'),false)) {
-			echo Bootstrap::formTitle(array('title'=>$L->g('Status')));
+		if (checkRole(array('admin'), false)) {
+			echo Bootstrap::formTitle(array('title' => $L->g('Status')));
 
 			echo Bootstrap::formInputText(array(
-				'name'=>'status',
-				'label'=>$L->g('Current status'),
-				'value'=>$user->enabled()?$L->g('Enabled'):$L->g('Disabled'),
-				'class'=>'',
-				'disabled'=>true,
-				'tip'=>$user->enabled()?'':$L->g('To enable the user you must set a new password')
+				'name' => 'status',
+				'label' => $L->g('Current status'),
+				'value' => $user->enabled() ? $L->g('Enabled') : $L->g('Disabled'),
+				'class' => '',
+				'disabled' => true,
+				'tip' => $user->enabled() ? '' : $L->g('To enable the user you must set a new password')
 			));
 
 			if ($user->enabled()) {
@@ -182,110 +182,119 @@
 				<div class="form-group row">
 				<div class="col-sm-2"></div>
 				<div class="col-sm-10">
-					<button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">'.$L->g('Disable user').'</button>
-					<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">'.$L->g('Delete user and keep content').'</button>
-					<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">'.$L->g('Delete user and delete content').'</button>
+					<button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">' . $L->g('Disable user') . '</button>
+					<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">' . $L->g('Delete user and keep content') . '</button>
+					<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">' . $L->g('Delete user and delete content') . '</button>
 				</div>
 				</div>
 				';
 			}
 		}
-	?>
+		?>
 	</div>
 
 	<!-- Social Networks tab -->
 	<div class="tab-pane fade" id="social" role="tabpanel" aria-labelledby="nav-social-tab">
-	<?php
+		<?php
+		echo Bootstrap::formInputText(array(
+			'name' => 'twitter',
+			'label' => 'Twitter',
+			'value' => $user->twitter(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
+		));
+
 		echo Bootstrap::formInputText(array(
-			'name'=>'twitter',
-			'label'=>'Twitter',
-			'value'=>$user->twitter(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'facebook',
+			'label' => 'Facebook',
+			'value' => $user->facebook(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'facebook',
-			'label'=>'Facebook',
-			'value'=>$user->facebook(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'codepen',
+			'label' => 'CodePen',
+			'value' => $user->codepen(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'codepen',
-			'label'=>'CodePen',
-			'value'=>$user->codepen(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'instagram',
+			'label' => 'Instagram',
+			'value' => $user->instagram(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'instagram',
-			'label'=>'Instagram',
-			'value'=>$user->instagram(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'gitlab',
+			'label' => 'GitLab',
+			'value' => $user->gitlab(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'gitlab',
-			'label'=>'GitLab',
-			'value'=>$user->gitlab(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'github',
+			'label' => 'GitHub',
+			'value' => $user->github(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'github',
-			'label'=>'GitHub',
-			'value'=>$user->github(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'linkedin',
+			'label' => 'LinkedIn',
+			'value' => $user->linkedin(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'linkedin',
-			'label'=>'LinkedIn',
-			'value'=>$user->linkedin(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'xing',
+			'label' => 'Xing',
+			'value' => $user->xing(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'xing',
-			'label'=>'Xing',
-			'value'=>$user->xing(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'telegram',
+			'label' => 'Telegram',
+			'value' => $user->telegram(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'mastodon',
-			'label'=>'Mastodon',
-			'value'=>$user->mastodon(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'mastodon',
+			'label' => 'Mastodon',
+			'value' => $user->mastodon(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
 
 		echo Bootstrap::formInputText(array(
-			'name'=>'vk',
-			'label'=>'VK',
-			'value'=>$user->vk(),
-			'class'=>'',
-			'placeholder'=>'',
-			'tip'=>''
+			'name' => 'vk',
+			'label' => 'VK',
+			'value' => $user->vk(),
+			'class' => '',
+			'placeholder' => '',
+			'tip' => ''
 		));
-	?>
+		?>
 	</div>
 </div>
 
@@ -304,4 +313,4 @@
 			//window.localStorage.removeItem("activeTab");
 		}
 	});
-</script>
+</script>

+ 1 - 1
bl-kernel/admin/views/login.php

@@ -34,4 +34,4 @@ echo '
 
 echo '</form>';
 
-echo '<p class="mt-3 text-right">' . $L->g('Powered by Bludit') . ((defined('BLUDIT_PRO')) ? ' PRO' : '') . '</p>'
+echo '<p class="mt-3 text-right">' . $L->g('Powered by Bludit') . ((defined('BLUDIT_PRO')) ? ' PRO' : '') . '</p>';

+ 9 - 0
bl-kernel/admin/views/settings.php

@@ -415,6 +415,15 @@ echo Bootstrap::formInputHidden(array(
 		'tip' => ''
 	));
 
+	echo Bootstrap::formInputText(array(
+		'name' => 'telegram',
+		'label' => 'Telegram',
+		'value' => $site->telegram(),
+		'class' => '',
+		'placeholder' => '',
+		'tip' => ''
+	));
+
 	echo Bootstrap::formInputText(array(
 		'name' => 'mastodon',
 		'label' => 'Mastodon',

+ 50 - 50
bl-kernel/helpers/theme.class.php

@@ -1,25 +1,27 @@
 <?php
 
-class Theme {
+class Theme
+{
 
 	public static function socialNetworks()
 	{
 		global $site;
 		$socialNetworks = array(
-			'github'=>'Github',
-			'gitlab'=>'GitLab',
-			'twitter'=>'Twitter',
-			'facebook'=>'Facebook',
-			'instagram'=>'Instagram',
-			'codepen'=>'Codepen',
-			'linkedin'=>'Linkedin',
-			'xing'=>'Xing',
-			'mastodon'=>'Mastodon',
-			'vk'=>'VK',
-			'dribbble'=>'Dribbble'
+			'github' => 'Github',
+			'gitlab' => 'GitLab',
+			'twitter' => 'Twitter',
+			'facebook' => 'Facebook',
+			'instagram' => 'Instagram',
+			'codepen' => 'Codepen',
+			'linkedin' => 'Linkedin',
+			'xing' => 'Xing',
+			'telegram' => 'Telegram',
+			'mastodon' => 'Mastodon',
+			'vk' => 'VK',
+			'dribbble' => 'Dribbble'
 		);
 
-		foreach ($socialNetworks as $key=>$label) {
+		foreach ($socialNetworks as $key => $label) {
 			if (!$site->{$key}()) {
 				unset($socialNetworks[$key]);
 			}
@@ -60,7 +62,7 @@ class Theme {
 	public static function rssUrl()
 	{
 		if (pluginActivated('pluginRSS')) {
-			return DOMAIN_BASE.'rss.xml';
+			return DOMAIN_BASE . 'rss.xml';
 		}
 		return false;
 	}
@@ -68,7 +70,7 @@ class Theme {
 	public static function sitemapUrl()
 	{
 		if (pluginActivated('pluginSitemap')) {
-			return DOMAIN_BASE.'sitemap.xml';
+			return DOMAIN_BASE . 'sitemap.xml';
 		}
 		return false;
 	}
@@ -91,9 +93,9 @@ class Theme {
 
 	public static function metaTags($tag)
 	{
-		if ($tag=='title') {
+		if ($tag == 'title') {
 			return self::metaTagTitle();
-		} elseif ($tag=='description') {
+		} elseif ($tag == 'description') {
 			return self::metaTagDescription();
 		}
 	}
@@ -107,11 +109,11 @@ class Theme {
 		global $WHERE_AM_I;
 		global $page;
 
-		if ($WHERE_AM_I=='page') {
+		if ($WHERE_AM_I == 'page') {
 			$format = $site->titleFormatPages();
 			$format = Text::replace('{{page-title}}', $page->title(), $format);
 			$format = Text::replace('{{page-description}}', $page->description(), $format);
-		} elseif ($WHERE_AM_I=='tag') {
+		} elseif ($WHERE_AM_I == 'tag') {
 			try {
 				$tagKey = $url->slug();
 				$tag = new Tag($tagKey);
@@ -120,8 +122,7 @@ class Theme {
 			} catch (Exception $e) {
 				// Tag doesn't exist
 			}
-
-		} elseif ($WHERE_AM_I=='category') {
+		} elseif ($WHERE_AM_I == 'category') {
 			try {
 				$categoryKey = $url->slug();
 				$category = new Category($categoryKey);
@@ -138,7 +139,7 @@ class Theme {
 		$format = Text::replace('{{site-slogan}}', $site->slogan(), $format);
 		$format = Text::replace('{{site-description}}', $site->description(), $format);
 
-		return '<title>'.$format.'</title>'.PHP_EOL;
+		return '<title>' . $format . '</title>' . PHP_EOL;
 	}
 
 	public static function metaTagDescription()
@@ -150,9 +151,9 @@ class Theme {
 
 		$description = $site->description();
 
-		if ($WHERE_AM_I=='page') {
+		if ($WHERE_AM_I == 'page') {
 			$description = $page->description();
-		} elseif ($WHERE_AM_I=='category') {
+		} elseif ($WHERE_AM_I == 'category') {
 			try {
 				$categoryKey = $url->slug();
 				$category = new Category($categoryKey);
@@ -162,7 +163,7 @@ class Theme {
 			}
 		}
 
-		return '<meta name="description" content="'.$description.'">'.PHP_EOL;
+		return '<meta name="description" content="' . $description . '">' . PHP_EOL;
 	}
 
 	// DEPRECATED v3.0.0
@@ -181,48 +182,48 @@ class Theme {
 
 	public static function charset($charset)
 	{
-		return '<meta charset="'.$charset.'">'.PHP_EOL;
+		return '<meta charset="' . $charset . '">' . PHP_EOL;
 	}
 
 	public static function viewport($content)
 	{
-		return '<meta name="viewport" content="'.$content.'">'.PHP_EOL;
+		return '<meta name="viewport" content="' . $content . '">' . PHP_EOL;
 	}
 
-	public static function src($file, $base=DOMAIN_THEME)
+	public static function src($file, $base = DOMAIN_THEME)
 	{
-		return $base.$file;
+		return $base . $file;
 	}
 
-	public static function css($files, $base=DOMAIN_THEME)
+	public static function css($files, $base = DOMAIN_THEME)
 	{
-		if( !is_array($files) ) {
+		if (!is_array($files)) {
 			$files = array($files);
 		}
 
 		$links = '';
-		foreach($files as $file) {
-			$links .= '<link rel="stylesheet" type="text/css" href="'.$base.$file.'?version='.BLUDIT_VERSION.'">'.PHP_EOL;
+		foreach ($files as $file) {
+			$links .= '<link rel="stylesheet" type="text/css" href="' . $base . $file . '?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
 		}
 
 		return $links;
 	}
 
-	public static function javascript($files, $base=DOMAIN_THEME, $attributes='')
+	public static function javascript($files, $base = DOMAIN_THEME, $attributes = '')
 	{
-		if( !is_array($files) ) {
+		if (!is_array($files)) {
 			$files = array($files);
 		}
 
 		$scripts = '';
-		foreach($files as $file) {
-			$scripts .= '<script '.$attributes.' src="'.$base.$file.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
+		foreach ($files as $file) {
+			$scripts .= '<script ' . $attributes . ' src="' . $base . $file . '?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
 		}
 
 		return $scripts;
 	}
 
-	public static function js($files, $base=DOMAIN_THEME, $attributes='')
+	public static function js($files, $base = DOMAIN_THEME, $attributes = '')
 	{
 		return self::javascript($files, $base, $attributes);
 	}
@@ -235,9 +236,9 @@ class Theme {
 		}
 	}
 
-	public static function favicon($file='favicon.png', $typeIcon='image/png')
+	public static function favicon($file = 'favicon.png', $typeIcon = 'image/png')
 	{
-		return '<link rel="icon" href="'.DOMAIN_THEME.$file.'" type="'.$typeIcon.'">'.PHP_EOL;
+		return '<link rel="icon" href="' . DOMAIN_THEME . $file . '" type="' . $typeIcon . '">' . PHP_EOL;
 	}
 
 	public static function keywords($keywords)
@@ -245,39 +246,38 @@ class Theme {
 		if (is_array($keywords)) {
 			$keywords = implode(',', $keywords);
 		}
-		return '<meta name="keywords" content="'.$keywords.'">'.PHP_EOL;
+		return '<meta name="keywords" content="' . $keywords . '">' . PHP_EOL;
 	}
 
 	public static function jquery()
 	{
-		return '<script src="'.DOMAIN_CORE_JS.'jquery.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
+		return '<script src="' . DOMAIN_CORE_JS . 'jquery.min.js?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
 	}
 
-	public static function jsBootstrap($attributes='')
+	public static function jsBootstrap($attributes = '')
 	{
-		return '<script '.$attributes.' src="'.DOMAIN_CORE_JS.'bootstrap.bundle.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
+		return '<script ' . $attributes . ' src="' . DOMAIN_CORE_JS . 'bootstrap.bundle.min.js?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
 	}
 
 	public static function cssBootstrap()
 	{
-		return '<link rel="stylesheet" type="text/css" href="'.DOMAIN_CORE_CSS.'bootstrap.min.css?version='.BLUDIT_VERSION.'">'.PHP_EOL;
+		return '<link rel="stylesheet" type="text/css" href="' . DOMAIN_CORE_CSS . 'bootstrap.min.css?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
 	}
 
 	public static function cssBootstrapIcons()
 	{
 		// https://icons.getbootstrap.com/
-		return '<link rel="stylesheet" type="text/css" href="'.DOMAIN_CORE_CSS.'bootstrap-icons/bootstrap-icons.css?version='.BLUDIT_VERSION.'">'.PHP_EOL;
+		return '<link rel="stylesheet" type="text/css" href="' . DOMAIN_CORE_CSS . 'bootstrap-icons/bootstrap-icons.css?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
 	}
 
 	public static function cssLineAwesome()
 	{
-		return '<link rel="stylesheet" type="text/css" href="'.DOMAIN_CORE_CSS.'line-awesome/css/line-awesome-font-awesome.min.css?version='.BLUDIT_VERSION.'">'.PHP_EOL;
+		return '<link rel="stylesheet" type="text/css" href="' . DOMAIN_CORE_CSS . 'line-awesome/css/line-awesome-font-awesome.min.css?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
 	}
 
-	public static function jsSortable($attributes='')
+	public static function jsSortable($attributes = '')
 	{
 		// https://github.com/psfpro/bootstrap-html5sortable
-		return '<script '.$attributes.' src="'.DOMAIN_CORE_JS.'jquery.sortable.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
+		return '<script ' . $attributes . ' src="' . DOMAIN_CORE_JS . 'jquery.sortable.min.js?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
 	}
-
 }

+ 6 - 0
bl-kernel/site.class.php

@@ -32,6 +32,7 @@ class Site extends dbJSON
 		'gitlab' =>		'',
 		'linkedin' =>		'',
 		'xing' =>		'',
+		'telegram' => '',
 		'mastodon' =>		'',
 		'dribbble' =>		'',
 		'vk' =>			'',
@@ -193,6 +194,11 @@ class Site extends dbJSON
 		return $this->getField('xing');
 	}
 
+	public function telegram()
+	{
+		return $this->getField('telegram');
+	}
+
 	public function mastodon()
 	{
 		return $this->getField('mastodon');

+ 17 - 11
bl-kernel/user.class.php

@@ -1,6 +1,7 @@
 <?php defined('BLUDIT') or die('Bludit CMS.');
 
-class User {
+class User
+{
 	protected $vars;
 
 	function __construct($username)
@@ -9,18 +10,18 @@ class User {
 
 		$this->vars['username'] = $username;
 
-		if ($username===false) {
+		if ($username === false) {
 			$row = $users->getDefaultFields();
 		} else {
 			if (Text::isEmpty($username) || !$users->exists($username)) {
-				$errorMessage = 'User not found in the database by username ['.$username.']';
-				Log::set(__METHOD__.LOG_SEP.$errorMessage);
+				$errorMessage = 'User not found in the database by username [' . $username . ']';
+				Log::set(__METHOD__ . LOG_SEP . $errorMessage);
 				throw new Exception($errorMessage);
 			}
 			$row = $users->getUserDB($username);
 		}
 
-		foreach ($row as $field=>$value) {
+		foreach ($row as $field => $value) {
 			$this->setField($field, $value);
 		}
 	}
@@ -145,6 +146,11 @@ class User {
 		return $this->getValue('xing');
 	}
 
+	public function telegram()
+	{
+		return $this->getValue('xing');
+	}
+
 	public function mastodon()
 	{
 		return $this->getValue('mastodon');
@@ -157,14 +163,14 @@ class User {
 
 	public function profilePicture()
 	{
-		$filename = $this->getValue('username').'.png';
-		if (!file_exists(PATH_UPLOADS_PROFILES.$filename)) {
+		$filename = $this->getValue('username') . '.png';
+		if (!file_exists(PATH_UPLOADS_PROFILES . $filename)) {
 			return false;
 		}
-		return DOMAIN_UPLOADS_PROFILES.$filename;
+		return DOMAIN_UPLOADS_PROFILES . $filename;
 	}
 
-	public function json($returnsArray=false)
+	public function json($returnsArray = false)
 	{
 		$tmp['username'] 	= $this->username();
 		$tmp['firstName'] 	= $this->firstName();
@@ -179,6 +185,7 @@ class User {
 		$tmp['gitlab'] 		= $this->gitlab();
 		$tmp['linkedin'] 	= $this->linkedin();
 		$tmp['xing'] 		= $this->xing();
+		$tmp['telegram'] 		= $this->telegram();
 		$tmp['mastodon']	= $this->mastodon();
 		$tmp['vk']		= $this->vk();
 		$tmp['profilePicture']	= $this->profilePicture();
@@ -189,5 +196,4 @@ class User {
 
 		return json_encode($tmp);
 	}
-
-}
+}

+ 32 - 0
bl-themes/alternative/img/telegram.svg

@@ -0,0 +1,32 @@
+
+<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+	 viewBox="0 0 512 512" xml:space="preserve">
+<path style="fill:#E1E1E3;" d="M483.643,42.893L18.751,222.234c-11.472,4.424-11.372,20.667,0.133,24.978l113.278,42.279
+	l43.845,141.006c2.806,9.031,13.849,12.369,21.179,6.377l63.142-51.475c6.618-5.393,16.046-5.662,22.963-0.641l113.887,82.685
+	c7.841,5.699,18.949,1.402,20.917-8.072l83.428-401.305C503.668,47.715,493.499,39.082,483.643,42.893z M395.044,136.412
+	L221.27,297.943c-6.108,5.686-10.048,13.295-11.164,21.553l-5.92,43.868c-0.784,5.858-9.012,6.439-10.628,0.77l-22.766-79.994
+	c-2.608-9.124,1.192-18.87,9.263-23.851l210.561-129.684C394.4,128.281,398.293,133.398,395.044,136.412z"/>
+<g>
+	<path style="fill:#A0A0A1;" d="M405.003,480.205c-4.892,0-9.726-1.533-13.823-4.511l-113.882-82.681
+		c-3.166-2.299-7.496-2.178-10.528,0.295l-63.14,51.473c-6.056,4.953-14.159,6.566-21.66,4.31
+		c-7.506-2.258-13.377-8.077-15.703-15.566l-42.359-136.225L15.317,256.77C6.056,253.299,0.048,244.678,0,234.804
+		c-0.047-9.865,5.873-18.534,15.08-22.085L479.972,33.377c8.041-3.106,17.12-1.571,23.698,4.005
+		c6.587,5.584,9.589,14.303,7.838,22.755L428.08,461.446c-1.63,7.85-7.073,14.268-14.56,17.163
+		C410.753,479.679,407.868,480.205,405.003,480.205z M272.231,370.973c5.976,0,11.962,1.835,17.052,5.531l113.887,82.685
+		c1.212,0.881,2.397,0.624,2.997,0.393c0.596-0.23,1.64-0.833,1.942-2.284L491.536,55.99c0.33-1.592-0.519-2.593-1.054-3.047
+		c-0.531-0.451-1.648-1.121-3.159-0.538c-0.003,0.001-0.006,0.002-0.008,0.003L22.423,231.751c-1.68,0.648-2.028,1.964-2.023,2.955
+		c0.005,0.999,0.366,2.321,2.062,2.957l113.265,42.275c2.956,1.104,5.235,3.514,6.173,6.527l43.845,141.006
+		c0.434,1.396,1.501,1.906,2.099,2.086c0.595,0.178,1.761,0.343,2.885-0.577l63.154-51.485
+		C259.204,373.158,265.712,370.973,272.231,370.973z M198.75,378.286c-6.985,0-13.054-4.534-14.999-11.355l-22.768-80
+		c-3.839-13.438,1.8-27.967,13.716-35.323l210.569-129.69c6.121-3.759,13.996-2.284,18.329,3.425
+		c4.328,5.702,3.633,13.675-1.618,18.545L228.214,305.413c-4.359,4.058-7.204,9.548-8.001,15.45l-5.92,43.866
+		c-0.992,7.412-6.901,12.974-14.367,13.515C199.532,378.272,199.139,378.286,198.75,378.286z M339.662,173.966l-154.258,95.007
+		c-4.17,2.573-6.148,7.661-4.805,12.365l16.527,58.072l2.871-21.278c1.428-10.566,6.515-20.387,14.323-27.655L339.662,173.966z"/>
+	<path style="fill:#A0A0A1;" d="M423.776,279.45c-0.717,0-1.444-0.075-2.174-0.234c-5.505-1.195-8.999-6.627-7.804-12.131l1.55-7.14
+		c1.195-5.505,6.626-9,12.131-7.804c5.505,1.195,8.999,6.627,7.804,12.131l-1.55,7.14
+		C432.697,276.188,428.471,279.45,423.776,279.45z"/>
+	<path style="fill:#A0A0A1;" d="M391.668,427.341c-0.717,0-1.444-0.075-2.174-0.234c-5.504-1.195-8.998-6.627-7.803-12.131
+		l23.459-108.051c1.194-5.505,6.62-8.999,12.132-7.804c5.504,1.195,8.998,6.627,7.803,12.131l-23.459,108.051
+		C400.588,424.08,396.363,427.341,391.668,427.341z"/>
+</g>
+</svg>

+ 32 - 0
bl-themes/blogx/img/telegram.svg

@@ -0,0 +1,32 @@
+
+<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+	 viewBox="0 0 512 512" xml:space="preserve">
+<path style="fill:#E1E1E3;" d="M483.643,42.893L18.751,222.234c-11.472,4.424-11.372,20.667,0.133,24.978l113.278,42.279
+	l43.845,141.006c2.806,9.031,13.849,12.369,21.179,6.377l63.142-51.475c6.618-5.393,16.046-5.662,22.963-0.641l113.887,82.685
+	c7.841,5.699,18.949,1.402,20.917-8.072l83.428-401.305C503.668,47.715,493.499,39.082,483.643,42.893z M395.044,136.412
+	L221.27,297.943c-6.108,5.686-10.048,13.295-11.164,21.553l-5.92,43.868c-0.784,5.858-9.012,6.439-10.628,0.77l-22.766-79.994
+	c-2.608-9.124,1.192-18.87,9.263-23.851l210.561-129.684C394.4,128.281,398.293,133.398,395.044,136.412z"/>
+<g>
+	<path style="fill:#A0A0A1;" d="M405.003,480.205c-4.892,0-9.726-1.533-13.823-4.511l-113.882-82.681
+		c-3.166-2.299-7.496-2.178-10.528,0.295l-63.14,51.473c-6.056,4.953-14.159,6.566-21.66,4.31
+		c-7.506-2.258-13.377-8.077-15.703-15.566l-42.359-136.225L15.317,256.77C6.056,253.299,0.048,244.678,0,234.804
+		c-0.047-9.865,5.873-18.534,15.08-22.085L479.972,33.377c8.041-3.106,17.12-1.571,23.698,4.005
+		c6.587,5.584,9.589,14.303,7.838,22.755L428.08,461.446c-1.63,7.85-7.073,14.268-14.56,17.163
+		C410.753,479.679,407.868,480.205,405.003,480.205z M272.231,370.973c5.976,0,11.962,1.835,17.052,5.531l113.887,82.685
+		c1.212,0.881,2.397,0.624,2.997,0.393c0.596-0.23,1.64-0.833,1.942-2.284L491.536,55.99c0.33-1.592-0.519-2.593-1.054-3.047
+		c-0.531-0.451-1.648-1.121-3.159-0.538c-0.003,0.001-0.006,0.002-0.008,0.003L22.423,231.751c-1.68,0.648-2.028,1.964-2.023,2.955
+		c0.005,0.999,0.366,2.321,2.062,2.957l113.265,42.275c2.956,1.104,5.235,3.514,6.173,6.527l43.845,141.006
+		c0.434,1.396,1.501,1.906,2.099,2.086c0.595,0.178,1.761,0.343,2.885-0.577l63.154-51.485
+		C259.204,373.158,265.712,370.973,272.231,370.973z M198.75,378.286c-6.985,0-13.054-4.534-14.999-11.355l-22.768-80
+		c-3.839-13.438,1.8-27.967,13.716-35.323l210.569-129.69c6.121-3.759,13.996-2.284,18.329,3.425
+		c4.328,5.702,3.633,13.675-1.618,18.545L228.214,305.413c-4.359,4.058-7.204,9.548-8.001,15.45l-5.92,43.866
+		c-0.992,7.412-6.901,12.974-14.367,13.515C199.532,378.272,199.139,378.286,198.75,378.286z M339.662,173.966l-154.258,95.007
+		c-4.17,2.573-6.148,7.661-4.805,12.365l16.527,58.072l2.871-21.278c1.428-10.566,6.515-20.387,14.323-27.655L339.662,173.966z"/>
+	<path style="fill:#A0A0A1;" d="M423.776,279.45c-0.717,0-1.444-0.075-2.174-0.234c-5.505-1.195-8.999-6.627-7.804-12.131l1.55-7.14
+		c1.195-5.505,6.626-9,12.131-7.804c5.505,1.195,8.999,6.627,7.804,12.131l-1.55,7.14
+		C432.697,276.188,428.471,279.45,423.776,279.45z"/>
+	<path style="fill:#A0A0A1;" d="M391.668,427.341c-0.717,0-1.444-0.075-2.174-0.234c-5.504-1.195-8.998-6.627-7.803-12.131
+		l23.459-108.051c1.194-5.505,6.62-8.999,12.132-7.804c5.504,1.195,8.998,6.627,7.803,12.131l-23.459,108.051
+		C400.588,424.08,396.363,427.341,391.668,427.341z"/>
+</g>
+</svg>

+ 11 - 11
bl-themes/blogx/php/navbar.php

@@ -10,20 +10,20 @@
 			<ul class="navbar-nav ml-auto">
 
 				<!-- Static pages -->
-				<?php foreach ($staticContent as $staticPage): ?>
-				<li class="nav-item">
-					<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
-				</li>
+				<?php foreach ($staticContent as $staticPage) : ?>
+					<li class="nav-item">
+						<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
+					</li>
 				<?php endforeach ?>
 
 				<!-- Social Networks -->
-				<?php foreach (Theme::socialNetworks() as $key=>$label): ?>
-				<li class="nav-item">
-					<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
-						<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME.'img/'.$key.'.svg' ?>" alt="<?php echo $label ?>" />
-						<span class="d-inline d-sm-none"><?php echo $label; ?></span>
-					</a>
-				</li>
+				<?php foreach (Theme::socialNetworks() as $key => $label) : ?>
+					<li class="nav-item">
+						<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
+							<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME . 'img/' . $key . '.svg' ?>" alt="<?php echo $label ?>" />
+							<span class="d-inline d-sm-none"><?php echo $label; ?></span>
+						</a>
+					</li>
 				<?php endforeach; ?>
 
 			</ul>

+ 2 - 0
install.php

@@ -396,6 +396,7 @@ function install($adminPassword, $timezone)
 		'gitlab' => '',
 		'linkedin' => '',
 		'xing' => '',
+		'telegram' => '',
 		'dateFormat' => 'F j, Y',
 		'extremeFriendly' => true,
 		'autosaveInterval' => 2,
@@ -432,6 +433,7 @@ function install($adminPassword, $timezone)
 			'codepen' => '',
 			'linkedin' => '',
 			'xing' => '',
+			'telegram' => '',
 			'github' => '',
 			'gitlab' => ''
 		)