public function validateSave($obj)
 {
     if (SettingsManager::getInstance()->getSetting("Attendance: Time-sheet Cross Check") == "1") {
         $attendance = new Attendance();
         $list = $attendance->Find("employee = ? and in_time <= ? and out_time >= ?", array($obj->employee, $obj->date_start, $obj->date_end));
         if (empty($list) || count($list) == 0) {
             return new IceResponse(IceResponse::ERROR, "The time entry can not be added since you have not marked attendance for selected period");
         }
     }
     return new IceResponse(IceResponse::SUCCESS, "");
 }
 public static function getInstance()
 {
     if (empty(self::$me)) {
         self::$me = new SettingsManager();
     }
     return self::$me;
 }
Beispiel #3
0
 public static function addWarning($text)
 {
     self::$warnings[] = $text;
     if (SettingsManager::getInstance()->isDebugMode()) {
         echo '<div class="warning">[Debug: Warning was added]' . $text . '</div>';
     }
 }
Beispiel #4
0
 public static function log($message, $level)
 {
     if ($level == self::LEVEL_DEBUG && !SettingsManager::getInstance()->isDebugMode()) {
         return;
     }
     DBManager::getInstance()->append('log.log', date('Y.m.d H:i:s') . ' – ' . $level . ': ' . $message);
 }
 public function __construct()
 {
     self::$spFilename = dirname(__FILE__) . '/SettingsManager.specialpage.wikitext';
     self::$mnName = dirname(__FILE__) . '/SettingsManager.settings.php';
     self::$templatePageName = dirname(__FILE__) . '/settingsmanager.namespaces.template';
     // help the user a bit by making sure
     // the file is writable when it comes to update it.
     @chmod(self::$mnName, 0644);
     $this->canUpdateFile = true;
     // Log related
     global $wgLogTypes, $wgLogNames, $wgLogHeaders, $wgLogActions;
     $wgLogTypes[] = 'mngs';
     $wgLogNames['mngs'] = 'mngslogpage';
     $wgLogHeaders['mngs'] = 'mngslogpagetext';
     $wgLogActions['mngs/updtok'] = 'mngs' . '-updtok-entry';
     $wgLogActions['mngs/updtfail1'] = 'mngs' . '-updtfail1-entry';
     $wgLogActions['mngs/updtfail2'] = 'mngs' . '-updtfail2-entry';
     $wgLogActions['mngs/updtfail3'] = 'mngs' . '-updtfail3-entry';
     $wgLogActions['mngs/updtfail4'] = 'mngs' . '-updtfail4-entry';
     // Messages.
     global $wgMessageCache;
     $msg = $GLOBALS['msg' . __CLASS__];
     foreach ($msg as $key => $value) {
         $wgMessageCache->addMessages($msg[$key], $key);
     }
 }
 public function generateJson($serverId)
 {
     $server = MurmurServer::fromIceObject(ServerInterface::getInstance()->getServer($serverId));
     $tree = $server->getTree();
     $array = array('id' => $server->getId(), 'name' => SettingsManager::getInstance()->getServerName($server->getId()), 'root' => $this->treeToJsonArray($tree));
     return json_encode($array);
 }
Beispiel #7
0
 public static function cap_cleanup()
 {
     $files = glob(SettingsManager::getInstance()->getMainDir() . '/tmp/*');
     foreach ($files as $filename) {
         if (filectime($filename) < time() - 300) {
             unlink($filename);
         }
     }
 }
Beispiel #8
0
 public static function getTemplate($name)
 {
     $filepath = SettingsManager::getInstance()->getThemeDir() . '/' . $name . '.template.php';
     if (file_exists($filepath)) {
         $template = file_get_contents($filepath);
     } else {
         HelperFunctions::addError('Template file not found when trying to parse template: ' . $name);
     }
 }
 public function sendLeaveApplicationEmail($employee, $cancellation = false)
 {
     $sup = $this->getEmployeeSupervisor($employee);
     if (empty($sup)) {
         return false;
     }
     $params = array();
     $params['supervisor'] = $sup->first_name . " " . $sup->last_name;
     $params['name'] = $employee->first_name . " " . $employee->last_name;
     $params['url'] = CLIENT_BASE_URL;
     if ($cancellation) {
         $email = $this->subActionManager->getEmailTemplate('leaveCancelled.html');
     } else {
         $email = $this->subActionManager->getEmailTemplate('leaveApplied.html');
     }
     $user = $this->subActionManager->getUserFromProfileId($sup->id);
     $emailTo = null;
     if (!empty($user)) {
         $emailTo = $user->email;
     }
     if (!empty($emailTo)) {
         if (!empty($this->emailSender)) {
             $ccList = array();
             $ccListStr = SettingsManager::getInstance()->getSetting("Leave: CC Emails");
             if (!empty($ccListStr)) {
                 $arr = explode(",", $ccListStr);
                 $count = count($arr) <= 4 ? count($arr) : 4;
                 for ($i = 0; $i < $count; $i++) {
                     if (filter_var($arr[$i], FILTER_VALIDATE_EMAIL)) {
                         $ccList[] = $arr[$i];
                     }
                 }
             }
             $bccList = array();
             $bccListStr = SettingsManager::getInstance()->getSetting("Leave: BCC Emails");
             if (!empty($bccListStr)) {
                 $arr = explode(",", $bccListStr);
                 $count = count($arr) <= 4 ? count($arr) : 4;
                 for ($i = 0; $i < $count; $i++) {
                     if (filter_var($arr[$i], FILTER_VALIDATE_EMAIL)) {
                         $bccList[] = $arr[$i];
                     }
                 }
             }
             if ($cancellation) {
                 $this->emailSender->sendEmail("Leave Cancellation Request Received", $emailTo, $email, $params, $ccList, $bccList);
             } else {
                 $this->emailSender->sendEmail("Leave Application Received", $emailTo, $email, $params, $ccList, $bccList);
             }
         }
     } else {
         LogManager::getInstance()->info("[sendLeaveApplicationEmail] email is empty");
     }
 }
 public function init()
 {
     if (SettingsManager::getInstance()->getSetting("Api: REST Api Enabled") == "1") {
         $user = BaseService::getInstance()->getCurrentUser();
         $dbUser = new User();
         $dbUser->Load("id = ?", array($user->id));
         $resp = RestApiManager::getInstance()->getAccessTokenForUser($dbUser);
         if ($resp->getStatus() != IceResponse::SUCCESS) {
             LogManager::getInstance()->error("Error occured while creating REST Api acces token for " . $user->username);
         }
     }
 }
Beispiel #11
0
 /**
  * @return SettingsManager
  */
 public static function getInstance()
 {
     // $obj=NULL){
     if (!isset(self::$instance)) {
         if (!isset($obj)) {
             self::$instance = new SettingsManager();
         } else {
             self::$instance = $obj;
         }
     }
     return self::$instance;
 }
 public function generateJson($serverId)
 {
     $serverIce = ServerInterface::getInstance()->getServer($serverId);
     if ($serverIce == null) {
         return json_encode(array());
     }
     $server = MurmurServer::fromIceObject(ServerInterface::getInstance()->getServer($serverId));
     $serverConnectAddress = SettingsManager::getInstance()->getServerAddress($server->getId());
     $path = urlencode($serverConnectAddress);
     $connecturlTemplate = $serverConnectAddress != null ? 'mumble://%s?version=1.2.0' : null;
     $tree = $server->getTree();
     $array = array('id' => $server->getId(), 'name' => SettingsManager::getInstance()->getServerName($server->getId()), 'x_connecturl' => sprintf($connecturlTemplate, $path), 'root' => $this->treeToJsonArray($tree, $connecturlTemplate, $path));
     return json_encode($array);
 }
Beispiel #13
0
 private function generateReport($report, $data)
 {
     $fileFirst = "Report_" . str_replace(" ", "_", $report->name) . "-" . date("Y-m-d_H-i-s");
     $file = $fileFirst . ".csv";
     $fileName = CLIENT_BASE_PATH . 'data/' . $file;
     $fp = fopen($fileName, 'w');
     foreach ($data as $fields) {
         fputcsv($fp, $fields);
     }
     fclose($fp);
     $uploadedToS3 = false;
     $uploadFilesToS3 = SettingsManager::getInstance()->getSetting("Files: Upload Files to S3");
     $uploadFilesToS3Key = SettingsManager::getInstance()->getSetting("Files: Amazon S3 Key for File Upload");
     $uploadFilesToS3Secret = SettingsManager::getInstance()->getSetting("Files: Amazone S3 Secret for File Upload");
     $s3Bucket = SettingsManager::getInstance()->getSetting("Files: S3 Bucket");
     $s3WebUrl = SettingsManager::getInstance()->getSetting("Files: S3 Web Url");
     if ($uploadFilesToS3 . '' == '1' && !empty($uploadFilesToS3Key) && !empty($uploadFilesToS3Secret) && !empty($s3Bucket) && !empty($s3WebUrl)) {
         $uploadname = CLIENT_NAME . "/" . $file;
         $s3FileSys = new S3FileSystem($uploadFilesToS3Key, $uploadFilesToS3Secret);
         $res = $s3FileSys->putObject($s3Bucket, $uploadname, $fileName, 'authenticated-read');
         if (empty($res)) {
             return array("ERROR", $file);
         }
         unlink($fileName);
         $file_url = $s3WebUrl . $uploadname;
         $file_url = $s3FileSys->generateExpiringURL($file_url);
         $uploadedToS3 = true;
     }
     $fileObj = new File();
     $fileObj->name = $fileFirst;
     $fileObj->filename = $file;
     $fileObj->file_group = "Report";
     $ok = $fileObj->Save();
     if (!$ok) {
         LogManager::getInstance()->info($fileObj->ErrorMsg());
         return array("ERROR", "Error generating report");
     }
     $headers = array_shift($data);
     if ($uploadedToS3) {
         return array("SUCCESS", array($file_url, $headers, $data));
     } else {
         return array("SUCCESS", array($file, $headers, $data));
     }
 }
 function __construct()
 {
     // Check that the PHP Ice extension is loaded.
     if (!extension_loaded('ice')) {
         MessageManager::addError(tr('error_noIceExtensionLoaded'));
     } else {
         $this->contextVars = SettingsManager::getInstance()->getDbInterface_iceSecrets();
         if (!function_exists('Ice_intVersion') || Ice_intVersion() < 30400) {
             // ice 3.3
             global $ICE;
             Ice_loadProfile();
             $this->conn = $ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address());
             $this->meta = $this->conn->ice_checkedCast("::Murmur::Meta");
             // use IceSecret if set
             if (!empty($this->contextVars)) {
                 $this->meta = $this->meta->ice_context($this->contextVars);
             }
             $this->meta = $this->meta->ice_timeout(10000);
         } else {
             // ice 3.4
             $initData = new Ice_InitializationData();
             $initData->properties = Ice_createProperties();
             $initData->properties->setProperty('Ice.ImplicitContext', 'Shared');
             $ICE = Ice_initialize($initData);
             /*
              * getImplicitContext() is not implemented for icePHP yet…
              * $ICE->getImplicitContext();
              * foreach ($this->contextVars as $key=>$value) {
              * 	 $ICE->getImplicitContext()->put($key, $value);
              * }
              */
             try {
                 $this->meta = Murmur_MetaPrxHelper::checkedCast($ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address()));
                 $this->meta = $this->meta->ice_context($this->contextVars);
             } catch (Ice_ConnectionRefusedException $exc) {
                 MessageManager::addError(tr('error_iceConnectionRefused'));
             }
         }
         $this->connect();
     }
 }
if (isset($_GET['action']) && $_GET['action'] == 'edit_texture') {
    echo ' enctype="multipart/form-data"';
}
?>
>
		<table class="fullwidth">
			<tr><?php 
// SERVER Information (not changeable)
?>
				<td class="formitemname"><?php 
echo tr('server');
?>
:</td>
				<td>
					<?php 
echo SettingsManager::getInstance()->getServerName($_SESSION['serverid']);
?>
				</td>
				<td></td>
			</tr>
			<tr><?php 
// USERNAME
?>
				<td class="formitemname"><?php 
echo tr('username');
?>
:</td>
				<td>
					<?php 
if (isset($_GET['action']) && $_GET['action'] == 'edit_uname') {
    ?>
Beispiel #16
0
 private function initIce34()
 {
     // ice 3.4
     $initData = new Ice_InitializationData();
     $initData->properties = Ice_createProperties();
     $initData->properties->setProperty('Ice.ImplicitContext', 'Shared');
     $initData->properties->setProperty('Ice.Default.EncodingVersion', '1.0');
     $ICE = Ice_initialize($initData);
     /*
      * getImplicitContext() is not implemented for icePHP yet…
      * $ICE->getImplicitContext();
      * foreach ($this->contextVars as $key=>$value) {
      * 	 $ICE->getImplicitContext()->put($key, $value);
      * }
      * which should result in 
      * $ICE->getImplicitContext()->put('secret', 'ts');
      * $ICE->getImplicitContext()->put('icesecret', 'ts');
      */
     try {
         $this->meta = Murmur_MetaPrxHelper::checkedCast($ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address()));
         $this->meta = $this->meta->ice_context($this->contextVars);
         //TODO: catch ProxyParseException, EndpointParseException, IdentityParseException from stringToProxy()
     } catch (Ice_ConnectionRefusedException $exc) {
         MessageManager::addError(tr('error_iceConnectionRefused'));
     }
 }
 public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
 {
     $shift = intval(SettingsManager::getInstance()->getSetting("Attendance: Shift (Minutes)"));
     $employee = new Employee();
     $data = array();
     $employees = $employee->Find("1=1");
     $attendance = new Attendance();
     $attendanceToday = $attendance->Find("date(in_time) = ?", array(date("Y-m-d")));
     $attendanceData = array();
     //Group by employee
     foreach ($attendanceToday as $attendance) {
         if (isset($attendanceData[$attendance->employee])) {
             $attendanceData[$attendance->employee][] = $attendance;
         } else {
             $attendanceData[$attendance->employee] = array($attendance);
         }
     }
     foreach ($employees as $employee) {
         $entry = new stdClass();
         $entry->id = $employee->id;
         $entry->employee = $employee->id;
         if (isset($attendanceData[$employee->id])) {
             $attendanceEntries = $attendanceData[$employee->id];
             foreach ($attendanceEntries as $atEntry) {
                 if ($atEntry->out_time == "0000-00-00 00:00:00" || empty($atEntry->out_time)) {
                     if (strtotime($atEntry->in_time) < time() + $shift * 60) {
                         $entry->status = "Clocked In";
                         $entry->statusId = 0;
                     }
                 }
             }
             if (empty($entry->status)) {
                 $entry->status = "Clocked Out";
                 $entry->statusId = 1;
             }
         } else {
             $entry->status = "Not Clocked In";
             $entry->statusId = 2;
         }
         $data[] = $entry;
     }
     function cmp($a, $b)
     {
         return $a->statusId - $b->statusId;
     }
     usort($data, "cmp");
     return $data;
 }
Beispiel #18
0
$oSEOContentManager = new ContentManager($oDB, $oFuseaction, $oLanguage, $fusebox['tableSEOContentTokens'], $fusebox['tableSEOContent'], $fusebox['tableSEOContentComments'], false);
$ogSEOContentManager = new ContentManager($oDB, $ogFuseaction, $oLanguage, $fusebox['tableSEOContentTokens'], $fusebox['tableSEOContent'], $fusebox['tableSEOContentComments'], false);
if (!$oSEOContentManager->initialize() || !$ogSEOContentManager->initialize()) {
    _throw("FNoSEOContentTable", "There is no seocontent table called \"{$fusebox['tableSEOContent']}\" present in DB");
}
// caching seocontent for current page
$oSEOContentManager->cacheContent();
$ogSEOContentManager->cacheContent();
// mail templates initialization
$ogMailTemplatesManager = new ContentManager($oDB, $ogFuseaction, $oLanguage, $fusebox['tableMailTemplatesTokens'], $fusebox['tableMailTemplates'], $fusebox['tableMailTemplatesComments'], false);
// checking if all is correct
if (!$ogMailTemplatesManager->initialize()) {
    _throw("FNoMailTemplatesTable", "There is no mail temlates table called \"{$fusebox['tableMailTemplates']}\" present in DB");
}
// settings manager initialization
$oSettingsManager = new SettingsManager($oDB, $fusebox['tableSettings']);
if (!$oSettingsManager->initialize()) {
    _throw("FNoSettingsTable", "There is no settings table called \"{$fusebox['tableSettings']}\" present in DB");
}
// retrieving settings
$oSettingsManager->cacheSettings();
// set website timezone
date_default_timezone_set($oSettingsManager->getValue("TimeZone", $fusebox['defaultTimeZone'], "STRING", "Default timezone for website"));
$oPropertyManager = new PropertyManager($oDB, $fusebox['tableProperties'], $fusebox['tableDictionary']);
// user manager initialization
$oUserManager = new UserManager($oDB, $fusebox['tableUsers'], $fusebox['defaultUser'], $fusebox['developer'], $fusebox['password']);
if (!$oUserManager->initialize()) {
    _throw("FNoUsersTable", "There is no users table called \"{$fusebox['tableUsers']}\" present in DB");
}
// adding or checking existence of developer, setting developer password to default
if (!$oUserManager->resetPassword($fusebox['developer'], 0, $fusebox['password'])) {
Beispiel #19
0
 public function fixJSON($json)
 {
     $noJSONRequests = SettingsManager::getInstance()->getSetting("System: Do not pass JSON in request");
     if ($noJSONRequests . "" == "1") {
         $json = str_replace("|", '"', $json);
     }
     return $json;
 }
Beispiel #20
0
 /**
  * add an admin group
  * @param $name group name
  */
 public function addAdminGroup($name)
 {
     if ($this->getAdminGroupByName($name) === null) {
         $fd = fopen(SettingsManager::getInstance()->getMainDir() . '/data/' . self::$filename_adminGroups, 'a');
         fwrite($fd, sprintf("%d;%s\n", $this->getNextAdminGroupID(), $name));
         fclose($fd);
     } else {
         MessageManager::addError(tr('db_admingroup_namealreadyexists'));
     }
 }
Beispiel #21
0
echo !empty($rootName) ? htmlspecialchars($rootName) : 'Root';
?>
';

		// create chan and user images as dom objects (for faster draw, especially SVG)
	  <?php 
$chanImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/channel_12.png';
$chanImgHtmlObj = '<img src="' . $chanImgUrl . '" alt=""/>';
if (SettingsManager::getInstance()->isViewerSVGImagesEnabled()) {
    $chanImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/channel.svg';
    $chanImgHtmlObj = '<object data="' . $chanImgUrl . '" type="image/svg+xml" width="12" height="12">' . $chanImgHtmlObj . '</object>';
}
$userImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/talking_off_12.png';
$userImgHtmlObj = '<img src="' . $userImgUrl . '" alt=""/>';
if (SettingsManager::getInstance()->isViewerSVGImagesEnabled()) {
    $userImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/talking_off.svg';
    $userImgHtmlObj = '<object data="' . $userImgUrl . '" type="image/svg+xml" width="12" height="12">' . $userImgHtmlObj . '</object>';
}
?>
		var mumpiChanImgHtmlObj = jQuery('<?php 
echo $chanImgHtmlObj;
?>
');
		var mumpiUserImgHtmlObj = jQuery('<?php 
echo $userImgHtmlObj;
?>
');

		function refreshTree()
		{
			showAjaxLoading();
Beispiel #22
0
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />

	<title><?php 
echo SettingsManager::getInstance()->getSiteTitle();
?>
</title>
	<meta name="description" content="<?php 
echo SettingsManager::getInstance()->getSiteDescription();
?>
" />
	<meta name="keywords" content="<?php 
echo SettingsManager::getInstance()->getSiteKeywords();
?>
" />
	<meta name="generator" content="MumPI by KCode" />
	<meta name="author" content="KCode.de" />

	<?php 
TemplateManager::parseTemplate('HTMLHead');
?>
</head>
<body>

<?php 
if (isset($_GET['page'])) {
    switch ($_GET['page']) {
        case 'register':
?>
/style.css" />
<link rel="stylesheet" type="text/css" href="<?php 
echo SettingsManager::getInstance()->getMainUrl();
?>
/js/jquery-ui-css/ui-lightness/jquery-ui.css" />
<!--[if IE]><link rel="stylesheet" type="text/css" href="<?php 
echo SettingsManager::getInstance()->getThemeUrl();
?>
/style_iefix.css" /><![endif]-->
<script type="text/javascript" src="<?php 
echo SettingsManager::getInstance()->getThemeUrl();
?>
/jquery.js"></script>
<script type="text/javascript" src="<?php 
echo SettingsManager::getInstance()->getThemeUrl();
?>
/jquery.editable.js"></script>
<script type="text/javascript" src="<?php 
echo SettingsManager::getInstance()->getMainUrl();
?>
/js/jquery-ui.js"></script>
<script type="text/javascript" src="<?php 
echo SettingsManager::getInstance()->getMainUrl();
?>
/js/mumpi.js"></script>
<script type="text/javascript">/*<![CDATA[*/var imgAjaxLoading='<img src="<?php 
echo SettingsManager::getInstance()->getThemeUrl();
?>
/img/ajax-loader.gif" alt="loading…"/>';/*]]>*/</script>
				<td class="helpicon" title="<?php 
    echo tr('register_help_password');
    ?>
"></td>
			</tr><tr>
				<td class="formitemname"><?php 
    echo tr('password_repeat');
    ?>
:</td>
				<td><input type="password" name="password2" id="password2" value="" /></td>
				<td class="helpicon" title="<?php 
    echo tr('register_help_password2');
    ?>
"></td>
<?php 
    if (SettingsManager::getInstance()->isUseCaptcha()) {
        ?>
			</tr><tr>
				<td class="formitemname"><?php 
        echo tr('antispam');
        ?>
:</td>
				<td></td>
				<td></td>
			</tr><tr>
				<td class="formitemname"><?php 
        Captcha::cap_show();
        ?>
 =</td>
				<td><input type="text" name="spamcheck" value="" /></td>
				<td class="helpicon" title="<?php 
Beispiel #25
0
		<div id="content">
			<h1><?php 
    echo tr('login_head');
    ?>
</h1>
			<form action="./?page=login&amp;action=dologin" method="post" style="width:400px;">
				<table class="fullwidth">
					<tr>
						<td class="formitemname"><?php 
    echo tr('server');
    ?>
:</td>
						<td>
							<?php 
    $servers = SettingsManager::getInstance()->getServers();
    ?>
							<select name="serverid">
								<?php 
    foreach ($servers as $sid => $server) {
        // Check that server allows login and does exist
        if ($server['allowlogin'] && ServerInterface::getInstance()->getServer($sid) != null) {
            echo '<option value="' . $sid . '">';
            echo $server['name'];
            echo '</option>';
        }
    }
    ?>
							</select>
						</td>
						<td class="helpicon" title="<?php 
Beispiel #26
0
        }
    }
    ?>
		</ul>
<?php 
} else {
    $_GET['sid'] = intval($_GET['sid']);
    if (!PermissionManager::getInstance()->isAdminOfServer($_GET['sid'])) {
        echo tr('permission_denied');
        MessageManager::echoAllMessages();
        exit;
    }
    $server = ServerInterface::getInstance()->getServer($_GET['sid']);
    ?>
	<h1>Server Details: <?php 
    echo SettingsManager::getInstance()->getServerName($_GET['sid']);
    ?>
</h1>
	<ul>
<?php 
    echo sprintf('<li><a class="jqlink" onclick="jq_server_getOnlineUsers(%d); return false;">Online Users</a></li>', $server->id());
    if (PermissionManager::getInstance()->serverCanViewRegistrations($server->id())) {
        echo sprintf('<li><a class="jqlink" onclick="jq_server_getRegistrations(%d); return false;">Registrations</a></li>', $server->id());
    }
    echo sprintf('<li><a class="jqlink" onclick="jq_server_getBans(%d); return false;">Bans</a></li>', $server->id());
    echo sprintf('<li><a class="jqlink" onclick="jq_server_showTree(%d); return false;">Channel-Tree</a></li>', $server->id());
    if (PermissionManager::getInstance()->serverCanGenSuUsPW($server->id())) {
        echo sprintf('<li id="li_server_superuserpassword"><a class="jqlink" onclick="if(confirm(\'Are you sure you want to generate and set a new SuperUser password?\')){jq_server_setSuperuserPassword(%d); return false;}">Generate new SuperuserPassword</a><div class="ajax_info"></div></li>', $server->id());
    }
    if (PermissionManager::getInstance()->serverCanEditConf($server->id())) {
        echo sprintf('<li><a class="jqlink" onclick="jq_server_config_show(%d); return false;">Config</a></li>', $server->id());
Beispiel #27
0
 public function getCompanyLogoUrl()
 {
     $logoFileSet = false;
     $logoFileName = CLIENT_BASE_PATH . "data/logo.png";
     $logoSettings = SettingsManager::getInstance()->getSetting("Company: Logo");
     if (!empty($logoSettings)) {
         $logoFileName = FileService::getInstance()->getFileUrl($logoSettings);
         $logoFileSet = true;
     }
     if (!$logoFileSet && !file_exists($logoFileName)) {
         return BASE_URL . "images/logo.png";
     }
     return $logoFileName;
 }
Beispiel #28
0
<div id="topline">
<div id="menu">
	<ul>
		<?php 
function echoMenuEntry($link, $textIndex)
{
    echo '<li><a href="' . $link . '">' . tr($textIndex) . '</a></li>';
}
echoMenuEntry('./', 'home');
if (!SessionManager::getInstance()->isUser()) {
    echoMenuEntry('./?page=login', 'login');
    echoMenuEntry('./?page=register', 'register');
} else {
    echoMenuEntry('./?page=profile', 'profile');
    echoMenuEntry('./?page=logout', 'logout');
}
if (SettingsManager::getInstance()->isShowAdminLink()) {
    echoMenuEntry('../admin/', 'admin_area');
}
?>
	</ul>
</div>
<?php 
if (isset($_SESSION['userid'])) {
    printf(tr('welcome_user'), ServerInterface::getInstance()->getUserName($_SESSION['serverid'], $_SESSION['userid']));
} else {
    echo tr('welcome_guest');
}
?>
</div>
Beispiel #29
0
        $userRoles = json_decode($user->user_roles, true);
    } else {
        $userRoles = array();
    }
    $commonRoles = array_intersect($modulePermissions['user_roles'], $userRoles);
    if (empty($commonRoles)) {
        echo "You are not allowed to access this page";
        exit;
    }
}
$logoFileName = CLIENT_BASE_PATH . "data/logo.png";
$logoFileUrl = CLIENT_BASE_URL . "data/logo.png";
if (!file_exists($logoFileName)) {
    $logoFileUrl = BASE_URL . "images/logo.png";
}
$companyName = SettingsManager::getInstance()->getSetting('Company: Name');
//Load meta info
$meta = json_decode(file_get_contents(MODULE_PATH . "/meta.json"), true);
include 'configureUIManager.php';
?>
<!DOCTYPE html>
<html>
    <head>
	    <meta charset="utf-8">
	    <title><?php 
echo APP_NAME;
?>
</title>
	    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	    <meta name="description" content="">
	    <meta name="author" content="">
Beispiel #30
0
    $saveFileName = str_replace(".", "-", $saveFileName);
}
$file = new File();
$file->Load("name = ?", array($saveFileName));
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = explode(',', "csv,doc,xls,docx,xlsx,txt,ppt,pptx,rtf,pdf,xml,jpg,bmp,gif,png,jpeg");
// max file size in bytes
$sizeLimit = MAX_FILE_SIZE_KB * 1024;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload(CLIENT_BASE_PATH . 'data/', $saveFileName);
// to pass data through iframe you will need to encode all html tags
$uploadFilesToS3 = SettingsManager::getInstance()->getSetting("Files: Upload Files to S3");
$uploadFilesToS3Key = SettingsManager::getInstance()->getSetting("Files: Amazon S3 Key for File Upload");
$uploadFilesToS3Secret = SettingsManager::getInstance()->getSetting("Files: Amazone S3 Secret for File Upload");
$s3Bucket = SettingsManager::getInstance()->getSetting("Files: S3 Bucket");
$s3WebUrl = SettingsManager::getInstance()->getSetting("Files: S3 Web Url");
$uploadedToS3 = false;
LogManager::getInstance()->info($uploadFilesToS3 . "|" . $uploadFilesToS3Key . "|" . $uploadFilesToS3Secret . "|" . $s3Bucket . "|" . $s3WebUrl . "|" . CLIENT_NAME);
if ($uploadFilesToS3 . '' == '1' && !empty($uploadFilesToS3Key) && !empty($uploadFilesToS3Secret) && !empty($s3Bucket) && !empty($s3WebUrl)) {
    $localFile = CLIENT_BASE_PATH . 'data/' . $result['filename'];
    $f_size = filesize($localFile);
    $uploadname = CLIENT_NAME . "/" . $result['filename'];
    LogManager::getInstance()->info("Upload file to s3:" . $uploadname);
    LogManager::getInstance()->info("Local file:" . $localFile);
    LogManager::getInstance()->info("Local file size:" . $f_size);
    $s3FileSys = new S3FileSystem($uploadFilesToS3Key, $uploadFilesToS3Secret);
    $res = $s3FileSys->putObject($s3Bucket, $uploadname, $localFile, 'authenticated-read');
    $file_url = $s3WebUrl . $uploadname;
    $file_url = $s3FileSys->generateExpiringURL($file_url);
    LogManager::getInstance()->info("Response from s3 file sys:" . print_r($res, true));
    unlink($localFile);