Skip to content

Commit

Permalink
FIX: Unix Line Endings
Browse files Browse the repository at this point in the history
  • Loading branch information
aljawaid committed Jan 30, 2023
1 parent 0713b59 commit 31d8d80
Show file tree
Hide file tree
Showing 5 changed files with 1,137 additions and 1,137 deletions.
60 changes: 30 additions & 30 deletions Controller/TechnicalSupportController.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<?php

namespace Kanboard\Plugin\KanboardSupport\Controller;

use Kanboard\Controller\BaseController;

/**
* Class Technical Support
*
* @author aljawaid
*
*/
class TechnicalSupportController extends \Kanboard\Controller\ConfigController
{
/**
* Display the Support Page
*
* @access public
*/
public function show()
{
$this->response->html($this->helper->layout->config('kanboardSupport:config/support', array(
'db_size' => $this->configModel->getDatabaseSize(),
'db_version' => $this->db->getDriver()->getDatabaseVersion(),
'user_agent' => $this->request->getServerVariable('HTTP_USER_AGENT'),
'title' => t('Settings').' &#10562; '.t('Technical Information'),
)));
}

}
<?php

namespace Kanboard\Plugin\KanboardSupport\Controller;

use Kanboard\Controller\BaseController;

/**
* Class Technical Support
*
* @author aljawaid
*
*/
class TechnicalSupportController extends \Kanboard\Controller\ConfigController
{
/**
* Display the Support Page
*
* @access public
*/
public function show()
{
$this->response->html($this->helper->layout->config('kanboardSupport:config/support', array(
'db_size' => $this->configModel->getDatabaseSize(),
'db_version' => $this->db->getDriver()->getDatabaseVersion(),
'user_agent' => $this->request->getServerVariable('HTTP_USER_AGENT'),
'title' => t('Settings').' &#10562; '.t('Technical Information'),
)));
}

}
198 changes: 99 additions & 99 deletions Helper/SupportHelper.php
Original file line number Diff line number Diff line change
@@ -1,99 +1,99 @@
<?php

namespace Kanboard\Plugin\KanboardSupport\Helper;

use Kanboard\Core\Base;

class SupportHelper extends Base
{
public function getBrowser()
{
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$browser = "N/A";
$browsers = [
'/msie/i' => 'Internet explorer',
'/firefox/i' => 'Firefox',
'/safari/i' => 'Safari',
'/chrome/i' => 'Chrome',
'/edge/i' => 'Edge',
'/opera/i' => 'Opera',
'/mobile/i' => 'Mobile browser',
];
foreach ($browsers as $regex => $value) {
if (preg_match($regex, $user_agent)) {
$browser = $value;
}
}
return $browser;
}

public function getPermissions($dir)
{
$perms = fileperms($dir);

switch ($perms & 0xF000) {
case 0xC000: // socket
$info = 's';
break;
case 0xA000: // symbolic link
$info = 'l';
break;
case 0x8000: // regular
$info = 'r';
break;
case 0x6000: // block special
$info = 'b';
break;
case 0x4000: // directory
$info = '<span class="p-type" title="Directory">d</span>';
break;
case 0x2000: // character special
$info = 'c';
break;
case 0x1000: // FIFO pipe
$info = 'p';
break;
default: // unknown
$info = 'u';
}

// Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x' ) :
(($perms & 0x0800) ? 'S' : '-'));

// Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x' ) :
(($perms & 0x0400) ? 'S' : '-'));

// World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));

echo $info;
clearstatcache();
}

public function getPermissionsLinux($directory)
{
if(!file_exists($directory)) return false;

echo substr(sprintf('%o', fileperms($directory)), -4);
clearstatcache();
}

public function getPermissionsOwner($directory)
{
$owner = posix_getpwuid(fileowner($directory));
echo $owner['name'];
}

}
<?php

namespace Kanboard\Plugin\KanboardSupport\Helper;

use Kanboard\Core\Base;

class SupportHelper extends Base
{
public function getBrowser()
{
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$browser = "N/A";
$browsers = [
'/msie/i' => 'Internet explorer',
'/firefox/i' => 'Firefox',
'/safari/i' => 'Safari',
'/chrome/i' => 'Chrome',
'/edge/i' => 'Edge',
'/opera/i' => 'Opera',
'/mobile/i' => 'Mobile browser',
];
foreach ($browsers as $regex => $value) {
if (preg_match($regex, $user_agent)) {
$browser = $value;
}
}
return $browser;
}

public function getPermissions($dir)
{
$perms = fileperms($dir);

switch ($perms & 0xF000) {
case 0xC000: // socket
$info = 's';
break;
case 0xA000: // symbolic link
$info = 'l';
break;
case 0x8000: // regular
$info = 'r';
break;
case 0x6000: // block special
$info = 'b';
break;
case 0x4000: // directory
$info = '<span class="p-type" title="Directory">d</span>';
break;
case 0x2000: // character special
$info = 'c';
break;
case 0x1000: // FIFO pipe
$info = 'p';
break;
default: // unknown
$info = 'u';
}

// Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x' ) :
(($perms & 0x0800) ? 'S' : '-'));

// Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x' ) :
(($perms & 0x0400) ? 'S' : '-'));

// World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));

echo $info;
clearstatcache();
}

public function getPermissionsLinux($directory)
{
if(!file_exists($directory)) return false;

echo substr(sprintf('%o', fileperms($directory)), -4);
clearstatcache();
}

public function getPermissionsOwner($directory)
{
$owner = posix_getpwuid(fileowner($directory));
echo $owner['name'];
}

}
6 changes: 3 additions & 3 deletions Template/config/sidebar.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<li<?= $this->app->checkMenuSelection('TechnicalSupport', 'show', 'KanboardSupport') ?>>
<?= $this->url->link(t('Technical Information'), 'TechnicalSupportController', 'show', ['plugin' => 'KanboardSupport']) ?>
</li>
<li<?= $this->app->checkMenuSelection('TechnicalSupport', 'show', 'KanboardSupport') ?>>
<?= $this->url->link(t('Technical Information'), 'TechnicalSupportController', 'show', ['plugin' => 'KanboardSupport']) ?>
</li>
Loading

0 comments on commit 31d8d80

Please sign in to comment.