add telegram support #1565

This commit is contained in:
Diego Najar 2024-06-30 21:48:29 +02:00
parent 4bfa4a74a9
commit 437190fcbb
10 changed files with 331 additions and 235 deletions

View file

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

View file

@ -34,4 +34,4 @@ echo '
echo '</form>'; 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>';

View file

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

View file

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

View file

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

View file

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

View file

@ -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>

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -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>

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -10,17 +10,17 @@
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<!-- Static pages --> <!-- Static pages -->
<?php foreach ($staticContent as $staticPage): ?> <?php foreach ($staticContent as $staticPage) : ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a> <a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
</li> </li>
<?php endforeach ?> <?php endforeach ?>
<!-- Social Networks --> <!-- Social Networks -->
<?php foreach (Theme::socialNetworks() as $key=>$label): ?> <?php foreach (Theme::socialNetworks() as $key => $label) : ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank"> <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 ?>" /> <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> <span class="d-inline d-sm-none"><?php echo $label; ?></span>
</a> </a>
</li> </li>

View file

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