mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-14 20:19:43 +01:00
hello github! 😘
This commit is contained in:
58
plugins/index.html
Executable file
58
plugins/index.html
Executable file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
|
||||
<title>Powered by Kleeja</title>
|
||||
<style type="text/css">* {
|
||||
font-size: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #CECFCE;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Tahoma, Arial, sans-serif;
|
||||
font-size: 100%;
|
||||
color: #69788E;
|
||||
margin: 10px 30px;
|
||||
background: #F7F7F7;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
text-decoration: none;
|
||||
color: #CECFCE;
|
||||
}
|
||||
|
||||
a:active, a:hover {
|
||||
text-decoration: underline;
|
||||
color: #111;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Trebuchet MS", Helvetica, sans-serif;
|
||||
font-size: 1.70em;
|
||||
font-weight: normal;
|
||||
color: #333333;
|
||||
margin-top: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.content_box {
|
||||
border: 1px dashed #CECFCE;
|
||||
background: #FFFFFF;
|
||||
padding: 10px;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}</style>
|
||||
</head>
|
||||
<body title="كليجا"><br/>
|
||||
<div class="content_box">
|
||||
<p>
|
||||
<a target="_blank" href="http://www.kleeja.com" title="kleeja"></a>
|
||||
</p>
|
||||
<br/>
|
||||
<h1><span style="font-size:250%;color:#D80000;">403 - Access forbidden!</span></h1></div>
|
||||
<br/>
|
||||
<div class="content_box"style="font-size: 140%">Powered by Kleeja</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
plugins/kj_ban_admin/icon.png
Normal file
BIN
plugins/kj_ban_admin/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
55
plugins/kj_ban_admin/index.html
Executable file
55
plugins/kj_ban_admin/index.html
Executable file
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
|
||||
<title>Powered by Kleeja</title>
|
||||
<style type="text/css">* {
|
||||
font-size: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #CECFCE;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Tahoma, Arial, sans-serif;
|
||||
font-size: 100%;
|
||||
color: #69788E;
|
||||
margin: 10px 30px;
|
||||
background: #F7F7F7;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
text-decoration: none;
|
||||
color: #CECFCE;
|
||||
}
|
||||
|
||||
a:active, a:hover {
|
||||
text-decoration: underline;
|
||||
color: #111;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Trebuchet MS", Helvetica, sans-serif;
|
||||
font-size: 1.70em;
|
||||
font-weight: normal;
|
||||
color: #333333;
|
||||
margin-top: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.content_box {
|
||||
border: 1px dashed #CECFCE;
|
||||
background: #FFFFFF;
|
||||
padding: 10px;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}</style>
|
||||
</head>
|
||||
<body title="كليجا"><br/>
|
||||
<div class="content_box"><h1><span style="font-size:250%;color:#D80000;">403 - Access forbidden!</span></h1></div>
|
||||
<br/>
|
||||
<div class="content_box"><span style="font-size: 140%">Powered by <a target="_blank"
|
||||
href="http://www.kleeja.com">Kleeja</a></span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
128
plugins/kj_ban_admin/init.php
Normal file
128
plugins/kj_ban_admin/init.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# kj_ban_admin
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['kj_ban_admin']['information'] = array(
|
||||
# The casual name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'Kleeja Admin Firewall',
|
||||
'ar' => 'جدار أمني للوحة كليجا'
|
||||
),
|
||||
# Who wrote this plugin?
|
||||
'plugin_developer' => 'Kleeja.com',
|
||||
# This plugin version
|
||||
'plugin_version' => '1.0',
|
||||
# Explain what is this plugin, why should I use it?
|
||||
'plugin_description' => array(
|
||||
'en' => 'Ban a user after so many invalid login attempts to Kleeja control panel',
|
||||
'ar' => 'حظر أي مستخدم يحاول الدخول للوحة كليجا بعد عدة محاولات خاطئة'
|
||||
),
|
||||
# Min version of Kleeja that's required to run this plugin
|
||||
'plugin_kleeja_version_min' => '2.0',
|
||||
# Max version of Kleeja that support this plugin, use 0 for unlimited
|
||||
'plugin_kleeja_version_max' => '3.0',
|
||||
# Should this plugin run before others?, 0 is normal, and higher number has high priority
|
||||
'plugin_priority' => 0
|
||||
);
|
||||
|
||||
//after installation message, you can remove it, it's not requiered
|
||||
$kleeja_plugin['kj_ban_admin']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك هذه الإضافة، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
<hr>
|
||||
<br>
|
||||
<h3>لاحظ:</h3>
|
||||
<b>عند حظر عضويتك قم بإزالة الحظر من phpMyAdmin، من جدول klj_stats</b>
|
||||
";
|
||||
$kleeja_plugin['kj_ban_admin']['first_run']['en'] = "
|
||||
Thanks for using this plugin, for bugs reports, contact us at: <br>
|
||||
info@kleeja.com
|
||||
<hr>
|
||||
<br>
|
||||
<h3>Note:</h3>
|
||||
<b>If your user account got banned, remove it using phpMyAdmin, from klj_stats table.</b>
|
||||
";
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['kj_ban_admin']['install'] = function ($plg_id) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
//Plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['kj_ban_admin']['update'] = function ($old_version, $new_version) {
|
||||
// if(version_compare($old_version, '0.5', '<')){
|
||||
// //... update to 0.5
|
||||
// }
|
||||
//
|
||||
// if(version_compare($old_version, '0.6', '<')){
|
||||
// //... update to 0.6
|
||||
// }
|
||||
|
||||
//you could use update_config, update_olang
|
||||
};
|
||||
|
||||
|
||||
# Plugin Uninstallation, function to be called at unistalling
|
||||
$kleeja_plugin['kj_ban_admin']['uninstall'] = function ($plg_id) {
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['kj_ban_admin']['functions'] = array(
|
||||
|
||||
'admin_login_submit_admin_page' => function ($args) {
|
||||
$ERRORS = $args['ERRORS'];
|
||||
if(sizeof($ERRORS)){
|
||||
$_SESSION['kj_ban_admin_attemps'] = !empty($_SESSION['kj_ban_admin_attemps'])
|
||||
? intval($_SESSION['kj_ban_admin_attemps'])+1
|
||||
: 1;
|
||||
}
|
||||
|
||||
if(!empty($_SESSION['kj_ban_admin_attemps']) && $_SESSION['kj_ban_admin_attemps'] > 10)
|
||||
{
|
||||
global $SQL, $dbprefix, $config;
|
||||
|
||||
$query = array(
|
||||
'SELECT' => 'ban',
|
||||
'FROM' => "{$dbprefix}stats"
|
||||
);
|
||||
|
||||
$result = $SQL->build($query);
|
||||
|
||||
$current_ban_data = $SQL->fetch_array($result);
|
||||
$current_ban_data = $current_ban_data['ban'];
|
||||
|
||||
if(trim($current_ban_data) == ''){
|
||||
$current_ban_data = get_ip();
|
||||
}else{
|
||||
$current_ban_data = rtrim($current_ban_data, '|') . '|'. get_ip();
|
||||
}
|
||||
|
||||
$update_query = array(
|
||||
'UPDATE' => "{$dbprefix}stats",
|
||||
'SET' => "ban='" . $SQL->escape($current_ban_data) . "'"
|
||||
);
|
||||
|
||||
$SQL->build($update_query);
|
||||
if($SQL->affected())
|
||||
{
|
||||
delete_cache('data_ban');
|
||||
}
|
||||
|
||||
unset($_SESSION['kj_ban_admin_attemps']);
|
||||
redirect($config['siteurl']);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
BIN
plugins/kj_download_speed_limit/icon.png
Normal file
BIN
plugins/kj_download_speed_limit/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
55
plugins/kj_download_speed_limit/index.html
Executable file
55
plugins/kj_download_speed_limit/index.html
Executable file
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
|
||||
<title>Powered by Kleeja</title>
|
||||
<style type="text/css">* {
|
||||
font-size: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #CECFCE;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Tahoma, Arial, sans-serif;
|
||||
font-size: 100%;
|
||||
color: #69788E;
|
||||
margin: 10px 30px;
|
||||
background: #F7F7F7;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
text-decoration: none;
|
||||
color: #CECFCE;
|
||||
}
|
||||
|
||||
a:active, a:hover {
|
||||
text-decoration: underline;
|
||||
color: #111;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Trebuchet MS", Helvetica, sans-serif;
|
||||
font-size: 1.70em;
|
||||
font-weight: normal;
|
||||
color: #333333;
|
||||
margin-top: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.content_box {
|
||||
border: 1px dashed #CECFCE;
|
||||
background: #FFFFFF;
|
||||
padding: 10px;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}</style>
|
||||
</head>
|
||||
<body title="كليجا"><br/>
|
||||
<div class="content_box"><h1><span style="font-size:250%;color:#D80000;">403 - Access forbidden!</span></h1></div>
|
||||
<br/>
|
||||
<div class="content_box"><span style="font-size: 140%">Powered by <a target="_blank"
|
||||
href="http://www.kleeja.com">Kleeja</a></span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
127
plugins/kj_download_speed_limit/init.php
Normal file
127
plugins/kj_download_speed_limit/init.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
# kleeja plugin
|
||||
#
|
||||
# version: 1.0
|
||||
# developer: kleeja team
|
||||
|
||||
# prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
# plugin basic information
|
||||
$kleeja_plugin['kj_download_speed_limit']['information'] = array(
|
||||
# the casual name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'KJ Download Speed Limit',
|
||||
'ar' => 'تحديد سرعة التحميل'
|
||||
),
|
||||
# who wrote this plugin?
|
||||
'plugin_developer' => 'kleeja.com',
|
||||
# this plugin version
|
||||
'plugin_version' => '1.1',
|
||||
# explain what is this plugin, why should i use it?
|
||||
'plugin_description' => array(
|
||||
'en' => 'Limit files download speed for each group',
|
||||
'ar' => 'تحديد سرعة تحميل الملفات لكل مجموعة'
|
||||
),
|
||||
|
||||
# min version of kleeja that's required to run this plugin
|
||||
'plugin_kleeja_version_min' => '2.3',
|
||||
# max version of kleeja that support this plugin, use 0 for unlimited
|
||||
'plugin_kleeja_version_max' => '3.0',
|
||||
# should this plugin run before others?, 0 is normal, and higher number has high priority
|
||||
'plugin_priority' => 0
|
||||
);
|
||||
|
||||
//after installation message, you can remove it, it's not requiered
|
||||
$kleeja_plugin['kj_download_speed_limit']['first_run']['ar'] = "
|
||||
تجد خيار تحديد سرعة التحميل في إعدادات كل مجموعة <br><br>
|
||||
شكراً لاستخدامك الإضافة، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
$kleeja_plugin['kj_download_speed_limit']['first_run']['en'] = "
|
||||
You will find the ability to change speed limit in each group settings.<Br><br>
|
||||
Thank you for using our plugin, if you encounter any bugs and errors, contact us: <br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
# plugin installation function
|
||||
$kleeja_plugin['kj_download_speed_limit']['install'] = function ($plg_id) {
|
||||
//new options
|
||||
$options = array(
|
||||
'kj_download_speed_limit_number' =>
|
||||
array(
|
||||
'value' => '30',
|
||||
'html' => configField('kj_download_speed_limit_number'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'groups',
|
||||
'order' => '1',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'KJ_DOWNLOAD_SPEED_LIMIT_NUMBER' => 'سرعة التحميل (كيلوبايت/ثانية)'
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'KJ_DOWNLOAD_SPEED_LIMIT_NUMBER' => 'Download Speed (KB/Second)',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['kj_download_speed_limit']['update'] = function ($old_version, $new_version) {
|
||||
// if(version_compare($old_version, '0.5', '<')){
|
||||
// //... update to 0.5
|
||||
// }
|
||||
//
|
||||
// if(version_compare($old_version, '0.6', '<')){
|
||||
// //... update to 0.6
|
||||
// }
|
||||
|
||||
//you could use update_config, update_olang
|
||||
};
|
||||
|
||||
|
||||
# plugin uninstalling, function to be called at uninstalling
|
||||
$kleeja_plugin['kj_download_speed_limit']['uninstall'] = function ($plg_id) {
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'kj_download_speed_limit_number',
|
||||
));
|
||||
|
||||
|
||||
delete_olang(null, null, $plg_id);
|
||||
};
|
||||
|
||||
|
||||
# plugin functions
|
||||
$kleeja_plugin['kj_download_speed_limit']['functions'] = array(
|
||||
'down_go_page' => function ($args) {
|
||||
global $config;
|
||||
|
||||
$givenSize = floatval(trim($config['kj_download_speed_limit_number']));
|
||||
|
||||
if($givenSize === 0){
|
||||
return;
|
||||
}
|
||||
|
||||
define('TrottleLimit', true);
|
||||
|
||||
$chunksize = round($givenSize * 1024);
|
||||
|
||||
return compact('chunksize');
|
||||
}
|
||||
);
|
||||
|
||||
BIN
plugins/language_switch/icon.png
Normal file
BIN
plugins/language_switch/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
55
plugins/language_switch/index.html
Executable file
55
plugins/language_switch/index.html
Executable file
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
|
||||
<title>Powered by Kleeja</title>
|
||||
<style type="text/css">* {
|
||||
font-size: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #CECFCE;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Tahoma, Arial, sans-serif;
|
||||
font-size: 100%;
|
||||
color: #69788E;
|
||||
margin: 10px 30px;
|
||||
background: #F7F7F7;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
text-decoration: none;
|
||||
color: #CECFCE;
|
||||
}
|
||||
|
||||
a:active, a:hover {
|
||||
text-decoration: underline;
|
||||
color: #111;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Trebuchet MS", Helvetica, sans-serif;
|
||||
font-size: 1.70em;
|
||||
font-weight: normal;
|
||||
color: #333333;
|
||||
margin-top: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.content_box {
|
||||
border: 1px dashed #CECFCE;
|
||||
background: #FFFFFF;
|
||||
padding: 10px;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}</style>
|
||||
</head>
|
||||
<body title="كليجا"><br/>
|
||||
<div class="content_box"><h1><span style="font-size:250%;color:#D80000;">403 - Access forbidden!</span></h1></div>
|
||||
<br/>
|
||||
<div class="content_box"><span style="font-size: 140%">Powered by <a target="_blank"
|
||||
href="http://www.kleeja.com">Kleeja</a></span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
169
plugins/language_switch/init.php
Normal file
169
plugins/language_switch/init.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# language_switch
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['language_switch']['information'] = array(
|
||||
# The casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'Language Switch',
|
||||
'ar' => 'تغيير اللغة'
|
||||
),
|
||||
# Who wrote this plugin?
|
||||
'plugin_developer' => 'Kleeja.com',
|
||||
# This plugin version
|
||||
'plugin_version' => '1.1',
|
||||
# Explain what is this plugin, why should I use it?
|
||||
'plugin_description' => array(
|
||||
'en' => 'A language switch box in the top of every page',
|
||||
'ar' => 'صندوق تغيير لغة في أعلى كل صفحة'
|
||||
),
|
||||
# Min version of Kleeja that's requiered to run this plugin
|
||||
'plugin_kleeja_version_min' => '2.0',
|
||||
# Max version of Kleeja that support this plugin, use 0 for unlimited
|
||||
'plugin_kleeja_version_max' => '3.0',
|
||||
# Should this plugin run before others?, 0 is normal, and higher number has high priority
|
||||
'plugin_priority' => 0
|
||||
);
|
||||
|
||||
//after installation message, you can remove it, it's not requiered
|
||||
$kleeja_plugin['language_switch']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك هذه الإضافة قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
$kleeja_plugin['language_switch']['first_run']['en'] = "
|
||||
Thanks for using this plugin, to report bugs contact us:
|
||||
<br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['language_switch']['install'] = function ($plg_id)
|
||||
{
|
||||
// //new language variables
|
||||
// add_olang(array(
|
||||
//
|
||||
// ),
|
||||
// 'ar',
|
||||
// $plg_id);
|
||||
//
|
||||
// add_olang(array(
|
||||
//
|
||||
// ),
|
||||
// 'en',
|
||||
// $plg_id);
|
||||
};
|
||||
|
||||
|
||||
//Plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['language_switch']['update'] = function ($old_version, $new_version) {
|
||||
// if(version_compare($old_version, '0.5', '<')){
|
||||
// //... update to 0.5
|
||||
// }
|
||||
//
|
||||
// if(version_compare($old_version, '0.6', '<')){
|
||||
// //... update to 0.6
|
||||
// }
|
||||
|
||||
//you could use update_config, update_olang
|
||||
};
|
||||
|
||||
|
||||
# Plugin Uninstallation, function to be called at unistalling
|
||||
$kleeja_plugin['language_switch']['uninstall'] = function ($plg_id) {
|
||||
//delete language variables
|
||||
// foreach (array('ar', 'en') as $language) {
|
||||
// delete_olang(null, $language, $plg_id);
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['language_switch']['functions'] = array(
|
||||
|
||||
'Saaheader_func' => function($args){
|
||||
|
||||
global $config;
|
||||
|
||||
$header = $args['header'];
|
||||
|
||||
|
||||
$available_languages = language_switch_get_languages();
|
||||
$available_languages_options = '';
|
||||
|
||||
$current_language = $config['language'];
|
||||
|
||||
|
||||
foreach ($available_languages as $lang) {
|
||||
$available_languages_options .= '<a href="' . $config['siteurl'] . '?lang=' . $lang . '"><img src="' . $config['siteurl'] . 'lang/' . $lang . '/icon_16.png" alt="' . $lang . '" style="padding:1px;' . ($current_language == $lang ? 'border:1px solid blue;' : 'border:1px solid white;') . '" /></a>';
|
||||
}
|
||||
|
||||
|
||||
$lang_switch_html = '<div id="langSwitch" style="position: relative; z-index: 100">' . "\n" .
|
||||
'<div id="langSwitchInner" style="position: absolute;top: 0;'.($current_language == 'ar' ? 'left':'right').': 80px; background-color: white; padding: 3px">' . "\n" .
|
||||
$available_languages_options . "\n" .
|
||||
'</div>'. "\n" .
|
||||
'</div>';
|
||||
|
||||
$header = preg_replace('/<body([^\>]*)>/i', "<body\\1>\n<!-- language switch -->\n" . $lang_switch_html . "\n<!-- language switch end -->", $header, 1);
|
||||
|
||||
return compact('header');
|
||||
},
|
||||
|
||||
|
||||
|
||||
'boot_common' => function ($args){
|
||||
global $config, $usrcp;
|
||||
|
||||
$current_language = $config['language'];
|
||||
|
||||
$available_languages = language_switch_get_languages();
|
||||
|
||||
if(ig('lang')){
|
||||
$chosen_lang = g('lang');
|
||||
if(in_array($chosen_lang, $available_languages)){
|
||||
$usrcp->kleeja_set_cookie('sllang', $chosen_lang, time() + 3600*24*30);
|
||||
$config['language'] = $chosen_lang;
|
||||
}
|
||||
}else {
|
||||
if (($cookie_lang = $usrcp->kleeja_get_cookie('sllang')) !== false) {
|
||||
if (in_array($cookie_lang, $available_languages)) {
|
||||
$config['language'] = $cookie_lang;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
if(!function_exists('language_switch_get_languages')){
|
||||
function language_switch_get_languages(){
|
||||
$available_languages = array();
|
||||
|
||||
if ($dh = @opendir(PATH . 'lang'))
|
||||
{
|
||||
while (($file = @readdir($dh)) !== false)
|
||||
{
|
||||
if(strpos($file, '.') === false && $file != '..' && $file != '.')
|
||||
{
|
||||
$available_languages[] = $file;
|
||||
}
|
||||
}
|
||||
@closedir($dh);
|
||||
}
|
||||
|
||||
return $available_languages;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user