move plugins out ...
2
.gitignore
vendored
@@ -1,6 +1,8 @@
|
||||
cache/*.php
|
||||
cache/*.log
|
||||
plugins/*.php
|
||||
plugins/*
|
||||
!plugins/index.html
|
||||
config.php
|
||||
uploads/*
|
||||
!uploads/index.html
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
|
||||
|
||||
|
||||
<!-- Breadcrumbs -->
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="./">{lang.R_CPINDEX}</a></li>
|
||||
<li class="breadcrumb-item">{lang.R_EXTRA}</li>
|
||||
<IF NAME="current_smt == he">
|
||||
<li class="breadcrumb-item active">{lang.ADD_HEADER_EXTRA}</li>
|
||||
<ELSEIF NAME="current_smt == fe">
|
||||
<li class="breadcrumb-item active">{lang.ADD_FOOTER_EXTRA}</li>
|
||||
</IF>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
<form method="post" action="{action}" id="extra_form">
|
||||
<IF NAME="current_smt == he">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{lang.EX_HEADER_N}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div id="accordion" role="tablist">
|
||||
<LOOP NAME="extra_pages.header">
|
||||
<div class="card mt-2">
|
||||
<div class="card-header" role="tab" id="heading{{name}}">
|
||||
<h6 class="mb-0">
|
||||
<a data-toggle="collapse" href="#collapse{{name}}" aria-expanded="true" aria-controls="collapse{{name}}">
|
||||
{olang.ADVANCED_EXTRAS_APPEAR_PAGE}: {{title}}
|
||||
</a>
|
||||
</h6>
|
||||
</div>
|
||||
|
||||
<div id="collapse{{name}}" class="collapse " role="tabpanel" aria-labelledby="heading{{name}}" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<textarea id="ex_header_{{name}}" name="ex_header_x[{{name}}]" class="form-control" rows="8">{{value}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</LOOP>
|
||||
</div>
|
||||
|
||||
|
||||
<ELSEIF NAME="current_smt == fe">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{lang.EX_FOOTER_N}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div id="accordion" role="tablist">
|
||||
<LOOP NAME="extra_pages.footer">
|
||||
<div class="card mt-2">
|
||||
<div class="card-header" role="tab" id="heading{{name}}">
|
||||
<h6 class="mb-0">
|
||||
<a data-toggle="collapse" href="#collapse{{name}}" aria-expanded="true" aria-controls="collapse{{name}}">
|
||||
{olang.ADVANCED_EXTRAS_APPEAR_PAGE}: {{title}}
|
||||
</a>
|
||||
</h6>
|
||||
</div>
|
||||
|
||||
<div id="collapse{{name}}" class="collapse " role="tabpanel" aria-labelledby="heading{{name}}" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<textarea id="ex_footer_{{name}}" name="ex_footer_x[{{name}}]" class="form-control" rows="8">{{value}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</LOOP>
|
||||
</div>
|
||||
|
||||
|
||||
</IF>
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
<input type="submit" name="submit" value="{lang.UPDATE_EXTRA}" class="btn btn-primary">
|
||||
|
||||
|
||||
|
||||
{H_FORM_KEYS}
|
||||
</form>
|
||||
|
||||
|
Before Width: | Height: | Size: 85 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,246 +0,0 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# advanced_extras
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// https://github.com/Falicon/BitlyPHP
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['advanced_extras']['information'] = array(
|
||||
# The casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'Advanced Extras',
|
||||
'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' => 'An advanced interface for the extra templates feature',
|
||||
'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.9',
|
||||
# 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['advanced_extras']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك هذه الإضافة قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
<hr>
|
||||
<br>
|
||||
<h3>لاحظ:</h3>
|
||||
<b>تجد إعدادات الإضافة في صفحة: هيدر وفوتر إضافي في اللوحة</b>
|
||||
";
|
||||
|
||||
$kleeja_plugin['advanced_extras']['first_run']['en'] = "
|
||||
Thanks for using this plugin, to report bugs contact us:
|
||||
<br>
|
||||
info@kleeja.com
|
||||
<hr>
|
||||
<br>
|
||||
<h3>Note:</h3>
|
||||
<b>You can find the settings at: Extra Templates page in the control panel</b>
|
||||
|
||||
";
|
||||
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['advanced_extras']['install'] = function ($plg_id)
|
||||
{
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'ADVANCED_EXTRAS_APPEAR_PAGE' => 'عرض في صفحة'
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'ADVANCED_EXTRAS_APPEAR_PAGE' => 'Appears in page',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//Plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['advanced_extras']['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['advanced_extras']['uninstall'] = function ($plg_id) {
|
||||
//delete language variables
|
||||
foreach (array('ar', 'en') as $language) {
|
||||
delete_olang(null, $language, $plg_id);
|
||||
}
|
||||
|
||||
global $SQL , $dbprefix;
|
||||
$update_query = array(
|
||||
'UPDATE' => "{$dbprefix}stats",
|
||||
'SET' => "ex_footer = '' , ex_header = '' "
|
||||
);
|
||||
|
||||
$SQL->build($update_query);
|
||||
|
||||
if($SQL->affected())
|
||||
{
|
||||
//delete cache ..
|
||||
delete_cache('data_extra');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['advanced_extras']['functions'] = array(
|
||||
'end_admin_page' => function($args){
|
||||
|
||||
if(!empty($args['go_to'])) {
|
||||
$go_to = $args['go_to'];
|
||||
|
||||
|
||||
if ($go_to == 'n_extra') {
|
||||
global $lang;
|
||||
|
||||
$ex_header = $args['ex_header'];
|
||||
$ex_footer = $args['ex_footer'];
|
||||
|
||||
$stylee = 'admin_adv_extras';
|
||||
$styleePath = dirname(__FILE__);
|
||||
|
||||
//$ex_header, $ex_footer
|
||||
|
||||
$ex_values['header'] = advanced_extras_get_values($ex_header);
|
||||
$ex_values['footer'] = advanced_extras_get_values($ex_footer);
|
||||
|
||||
foreach (array('header', 'footer') as $k) {
|
||||
$extra_pages[$k] = array(
|
||||
array('name' => 'all', 'title' => $lang['ALL'], 'value' => isset($ex_values[$k]['all']) ? $ex_values[$k]['all'] : ''),
|
||||
array('name' => 'index', 'title' => $lang['INDEX'], 'value' => isset($ex_values[$k]['index']) ? $ex_values[$k]['index'] : ''),
|
||||
array('name' => 'download', 'title' => $lang['DOWNLOAD'], 'value' => isset($ex_values[$k]['download']) ? $ex_values[$k]['download'] : ''),
|
||||
array('name' => 'rules', 'title' => $lang['RULES'], 'value' => isset($ex_values[$k]['rules']) ? $ex_values[$k]['rules'] : ''),
|
||||
array('name' => 'guide', 'title' => $lang['GUIDE'], 'value' => isset($ex_values[$k]['guide']) ? $ex_values[$k]['guide'] : ''),
|
||||
array('name' => 'stats', 'title' => $lang['STATS'], 'value' => isset($ex_values[$k]['stats']) ? $ex_values[$k]['stats'] : ''),
|
||||
array('name' => 'reports', 'title' => $lang['REPORT'], 'value' => isset($ex_values[$k]['reports']) ? $ex_values[$k]['reports'] : ''),
|
||||
array('name' => 'call', 'title' => $lang['CALL'], 'value' => isset($ex_values[$k]['call']) ? $ex_values[$k]['call'] : ''),
|
||||
array('name' => 'profile', 'title' => $lang['PROFILE'], 'value' => isset($ex_values[$k]['profile']) ? $ex_values[$k]['profile'] : ''),
|
||||
array('name' => 'fileuser', 'title' => $lang['YOUR_FILEUSER'], 'value' => isset($ex_values[$k]['fileuser']) ? $ex_values[$k]['fileuser'] : ''),
|
||||
array('name' => 'login', 'title' => $lang['LOGIN'], 'value' => isset($ex_values[$k]['login']) ? $ex_values[$k]['login'] : ''),
|
||||
array('name' => 'register', 'title' => $lang['REGISTER'], 'value' => isset($ex_values[$k]['register']) ? $ex_values[$k]['register'] : ''),
|
||||
);
|
||||
}
|
||||
|
||||
return compact('stylee', 'styleePath', 'extra_pages');
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
'require_admin_page_begin_n_extra' => function ($args) {
|
||||
|
||||
if(ip('submit')){
|
||||
|
||||
$_POST['ex_header'] = '';
|
||||
$_POST['ex_footer'] = '';
|
||||
|
||||
if(!empty($_POST['ex_header_x']) && is_array($_POST['ex_header_x'])){
|
||||
foreach ($_POST['ex_header_x'] as $key => $value){
|
||||
$_POST['ex_header'] .= "\n!!! start advanced_extras ". htmlspecialchars($key) ." !!!\n".$value."\n!!! end advanced_extras ". htmlspecialchars($key) ." !!!\n";
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['ex_footer_x']) && is_array($_POST['ex_footer_x'])){
|
||||
foreach ($_POST['ex_footer_x'] as $key => $value){
|
||||
$_POST['ex_footer'] .= "\n!!! start advanced_extras ". htmlspecialchars($key) ." !!!\n".$value."\n!!! end advanced_extras ". htmlspecialchars($key) ." !!!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'Saaheader_links_func' => function($args){
|
||||
|
||||
$extras = $args['extras'];
|
||||
$go_page = g('go', 'str',
|
||||
defined('IN_DOWNLOAD') ? 'download' : (defined('IN_REAL_INDEX') ? 'index' : ''));
|
||||
|
||||
if(!empty($extras['header'])){
|
||||
$ex_extras = advanced_extras_get_values($extras['header']);
|
||||
|
||||
$extras['header'] = $ex_extras['all'];
|
||||
foreach ($ex_extras as $page=>$value){
|
||||
if($page == $go_page){
|
||||
$extras['header'] .= (trim($extras['header']) == '' ? '' : '<br>') . $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return compact('extras');
|
||||
},
|
||||
|
||||
'Saafooter_func' => function($args){
|
||||
|
||||
$extras = $args['extras'];
|
||||
$go_page = g('go', 'str',
|
||||
defined('IN_DOWNLOAD') ? 'download' : (defined('IN_REAL_INDEX') ? 'index' : ''));
|
||||
|
||||
if(!empty($extras['footer'])){
|
||||
$ex_extras = advanced_extras_get_values($extras['footer']);
|
||||
|
||||
$extras['footer'] = $ex_extras['all'];
|
||||
foreach ($ex_extras as $page=>$value){
|
||||
if($page == $go_page){
|
||||
$extras['footer'] .= (trim($extras['footer']) == '' ? '' : '<br>') . $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return compact('extras');
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* special functions
|
||||
*/
|
||||
|
||||
if (!function_exists('advanced_extras_get_values')) {
|
||||
function advanced_extras_get_values($content)
|
||||
{
|
||||
$re = '/!!! start advanced_extras ([a-zA-Z0-9_]+) !!!\n?(.*?)\n?!!! end advanced_extras \1 !!!/sm';
|
||||
|
||||
preg_match_all($re, $content, $matches, PREG_SET_ORDER, 0);
|
||||
|
||||
$values = array();
|
||||
|
||||
if(!empty($matches)) {
|
||||
foreach ($matches as $match) {
|
||||
$values[$match[1]] = $match[2];
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
@@ -1,302 +0,0 @@
|
||||
<!doctype html>
|
||||
<html amp lang="{lang.LANG_SMALL_NAME}" dir="{dir}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script async src="https://cdn.ampproject.org/v0.js"></script>
|
||||
|
||||
<!-- components -->
|
||||
<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
|
||||
<script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
|
||||
|
||||
|
||||
<script async custom-element="amp-sticky-ad" src="https://cdn.ampproject.org/v0/amp-sticky-ad-1.0.js"></script>
|
||||
<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
|
||||
|
||||
|
||||
<title>{title}</title>
|
||||
<link rel="canonical" href="{amp_canonical}">
|
||||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
|
||||
|
||||
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style>
|
||||
<noscript>
|
||||
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style>
|
||||
</noscript>
|
||||
|
||||
<style amp-custom>
|
||||
.header {
|
||||
position: relative;
|
||||
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);
|
||||
padding-top: 52px;
|
||||
}
|
||||
.header {
|
||||
background-color: #607D8B;
|
||||
}
|
||||
.header #sample-menu {
|
||||
position:absolute;
|
||||
top:0;
|
||||
<IF NAME="lang.DIR==ltr">left<ELSE>right</IF>:0;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
text-transform: uppercase;
|
||||
padding: 13px;
|
||||
}
|
||||
.header #sample-logo {
|
||||
position:absolute;
|
||||
top:0;
|
||||
<IF NAME="lang.DIR==ltr">left<ELSE>right</IF>:36px;
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
color: white;
|
||||
text-transform: uppercase;
|
||||
margin: 0 16px;
|
||||
height: 32px;
|
||||
text-decoration: none;
|
||||
line-height: 52px;
|
||||
}
|
||||
|
||||
.header #sample-logo {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: visibility 0s 0.7s, opacity 0.7s ease;
|
||||
}
|
||||
.header #sample-logo {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
transition: opacity 1.5s ease;
|
||||
}
|
||||
|
||||
.m1{margin:1rem}
|
||||
|
||||
.svg-icon path,
|
||||
.svg-icon polygon,
|
||||
.svg-icon rect {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.svg-icon circle {
|
||||
stroke: #fff;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
amp-sidebar{margin-top:3.5rem}
|
||||
|
||||
.block{display:block}
|
||||
.p1{padding:1rem}
|
||||
.text-decoration-none{text-decoration:none}
|
||||
|
||||
.ampstart-btn {
|
||||
font-family: inherit;
|
||||
font-weight: inherit;
|
||||
font-size: 1rem;
|
||||
line-height: 1.125rem;
|
||||
padding: .7em .8em;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
word-wrap: normal;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
background-color: #fff;
|
||||
color: #b60845;
|
||||
border: 1px solid #b60845
|
||||
}
|
||||
|
||||
.ampstart-btn:visited {
|
||||
color: #b60845
|
||||
}
|
||||
|
||||
.ampstart-btn-secondary {
|
||||
background-color: #b60845;
|
||||
color: #fff;
|
||||
border: 1px solid #fff
|
||||
}
|
||||
|
||||
.ampstart-btn-secondary:visited {
|
||||
color: #fff
|
||||
}
|
||||
|
||||
.ampstart-btn:active .ampstart-btn:focus {
|
||||
opacity: .8
|
||||
}
|
||||
|
||||
.ampstart-btn[disabled], .ampstart-btn[disabled]:active, .ampstart-btn[disabled]:focus, .ampstart-btn[disabled]:hover {
|
||||
opacity: .5;
|
||||
outline: 0;
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.file-info-list{
|
||||
margin: 14px;
|
||||
}
|
||||
|
||||
.file-info-list p{
|
||||
background: #f9f7f7;
|
||||
padding: 6px;
|
||||
box-shadow: 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 1px -1px rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
|
||||
}
|
||||
|
||||
.file-info-list p .title{
|
||||
color: #414446;
|
||||
}
|
||||
|
||||
.clearfix{
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.download{
|
||||
|
||||
margin:10px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.download .size{
|
||||
display: block;
|
||||
margin:15px;
|
||||
color: #4b5257;
|
||||
}
|
||||
|
||||
.svg-down{
|
||||
margin-bottom: -5px;
|
||||
}
|
||||
.svg-down path,
|
||||
.svg-down polygon,
|
||||
.svg-down rect {
|
||||
fill: #b60845;
|
||||
}
|
||||
|
||||
.svg-down circle {
|
||||
stroke: #b60845;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- sidebar -->
|
||||
<amp-sidebar id="drawermenu"
|
||||
layout="nodisplay">
|
||||
|
||||
<LOOP NAME="top_menu">
|
||||
<IF LOOP="show">
|
||||
<a href="{{url}}" class="text-decoration-none block p1">{{title}}</a>
|
||||
</IF>
|
||||
</LOOP>
|
||||
|
||||
|
||||
<LOOP NAME="side_menu">
|
||||
<IF LOOP="show">
|
||||
<a href="{{url}}" class="text-decoration-none block p1">{{title}}</a>
|
||||
</IF>
|
||||
</LOOP>
|
||||
|
||||
</amp-sidebar>
|
||||
|
||||
|
||||
<!-- header -->
|
||||
<div class="header">
|
||||
<a id="sample-menu"
|
||||
on="tap:drawermenu.toggle">
|
||||
|
||||
<svg class="svg-icon" viewBox="0 0 20 20" width="24" height="24">
|
||||
<path d="M10,1.445c-4.726,0-8.555,3.829-8.555,8.555c0,4.725,3.829,8.555,8.555,8.555c4.725,0,8.555-3.83,8.555-8.555C18.555,5.274,14.725,1.445,10,1.445 M10,17.654c-4.221,0-7.654-3.434-7.654-7.654c0-4.221,3.433-7.654,7.654-7.654c4.222,0,7.654,3.433,7.654,7.654C17.654,14.221,14.222,17.654,10,17.654 M14.39,10c0,0.248-0.203,0.45-0.45,0.45H6.06c-0.248,0-0.45-0.203-0.45-0.45s0.203-0.45,0.45-0.45h7.879C14.187,9.55,14.39,9.752,14.39,10 M14.39,12.702c0,0.247-0.203,0.449-0.45,0.449H6.06c-0.248,0-0.45-0.202-0.45-0.449c0-0.248,0.203-0.451,0.45-0.451h7.879C14.187,12.251,14.39,12.454,14.39,12.702 M14.39,7.298c0,0.248-0.203,0.45-0.45,0.45H6.06c-0.248,0-0.45-0.203-0.45-0.45s0.203-0.45,0.45-0.45h7.879C14.187,6.848,14.39,7.051,14.39,7.298"></path>
|
||||
</svg>
|
||||
|
||||
</a>
|
||||
|
||||
<a id="sample-logo" href="{config.siteurl}">{config.sitename}</a>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- title -->
|
||||
<h1 class="m1">{title}</h1>
|
||||
|
||||
<!-- share buttons -->
|
||||
<div class="m1">
|
||||
<amp-social-share type="twitter" width="30" height="22"></amp-social-share>
|
||||
<amp-social-share type="facebook" width="30" height="22"></amp-social-share>
|
||||
|
||||
<amp-social-share type="whatsapp" width="30" height="22"></amp-social-share>
|
||||
|
||||
<amp-social-share type="gplus" width="30" height="22"></amp-social-share>
|
||||
<amp-social-share type="email" width="30" height="22"></amp-social-share>
|
||||
<amp-social-share type="pinterest" width="33" height="22"></amp-social-share>
|
||||
</div>
|
||||
|
||||
|
||||
<!--extra-->
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<IF NAME="top_ad">
|
||||
<amp-ad width=300 height=250
|
||||
type="adsense"
|
||||
layout="responsive"
|
||||
data-ad-client="{adsense_client}"
|
||||
data-ad-slot="{top_ad}">
|
||||
</amp-ad>
|
||||
</IF>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<!-- info list -->
|
||||
|
||||
<div class="file-info-list">
|
||||
<p><span class="title">{lang.FILENAME}: </span> {name}</p>
|
||||
<p><span class="title">{lang.FILETYPE}: </span> {type}</p>
|
||||
<p><span class="title">{lang.FILESIZE}: </span> {size}</p>
|
||||
<p><span class="title">{lang.FILEDATE}: </span> {time}</p>
|
||||
<p><span class="title">{lang.FILEUPS}: </span> {uploads}</p>
|
||||
<IF NAME="fusername">
|
||||
<p><span class="title">{lang.USERNAME}: </span> <a href="{userfolder}">{fusername}</a></p>
|
||||
</IF>
|
||||
<p class="report">
|
||||
<small><a href="{REPORT}" rel="nofollow"> {lang.FILEREPORT}</a></small>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<IF NAME="middle_ad">
|
||||
<amp-ad width=300 height=250
|
||||
type="adsense"
|
||||
layout="responsive"
|
||||
data-ad-client="{adsense_client}"
|
||||
data-ad-slot="{middle_ad}">
|
||||
</amp-ad>
|
||||
</IF>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<p class="download">
|
||||
<a href="{url_file}" target="_blank" class="ampstart-btn">
|
||||
<svg class="svg-down" viewBox="0 0 20 20" height="24" width="24">
|
||||
<path d="M13.962,8.885l-3.736,3.739c-0.086,0.086-0.201,0.13-0.314,0.13S9.686,12.71,9.6,12.624l-3.562-3.56C5.863,8.892,5.863,8.611,6.036,8.438c0.175-0.173,0.454-0.173,0.626,0l3.25,3.247l3.426-3.424c0.173-0.172,0.451-0.172,0.624,0C14.137,8.434,14.137,8.712,13.962,8.885 M18.406,10c0,4.644-3.763,8.406-8.406,8.406S1.594,14.644,1.594,10S5.356,1.594,10,1.594S18.406,5.356,18.406,10 M17.521,10c0-4.148-3.373-7.521-7.521-7.521c-4.148,0-7.521,3.374-7.521,7.521c0,4.147,3.374,7.521,7.521,7.521C14.148,17.521,17.521,14.147,17.521,10"></path>
|
||||
</svg>
|
||||
|
||||
{lang.CLICK_DOWN}</a>
|
||||
|
||||
<small class="size">{size}</small>
|
||||
</p>
|
||||
|
||||
<IF NAME="sticky_ad">
|
||||
<amp-sticky-ad layout="nodisplay">
|
||||
<amp-ad width=300 height=250
|
||||
type="adsense"
|
||||
data-ad-client="{adsense_client}"
|
||||
data-ad-slot="{sticky_ad}">
|
||||
</amp-ad>
|
||||
</amp-sticky-ad>
|
||||
</IF>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 111 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,241 +0,0 @@
|
||||
<?php
|
||||
# kleeja plugin
|
||||
# kj_amp_seo
|
||||
# developer: kleeja team
|
||||
|
||||
# prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# plugin basic information
|
||||
$kleeja_plugin['kj_amp_seo']['information'] = array(
|
||||
# the casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'KJ AMP SEO',
|
||||
'ar' => 'AMP سيو'
|
||||
),
|
||||
# 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' => 'Add AMP support to download pages to enhance SEO for Kleeja',
|
||||
'ar' => 'دعم الـ AMP لصفحات التحميل لدعم السيو في كليجا'
|
||||
),
|
||||
# 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.9',
|
||||
# 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_amp_seo']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك إضافة كليجا هذه، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
$kleeja_plugin['kj_amp_seo']['first_run']['en'] = "
|
||||
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_amp_seo']['install'] = function ($plg_id) {
|
||||
//new options
|
||||
$options = array(
|
||||
'kj_amp_seo_enable' =>
|
||||
array(
|
||||
'value' => '1',
|
||||
'html' => configField('kj_amp_seo_enable', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_amp_seo',
|
||||
'order' => '1',
|
||||
),
|
||||
'kj_amp_seo_share_buttons' =>
|
||||
array(
|
||||
'value' => '1',
|
||||
'html' => configField('kj_amp_seo_share_buttons', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_amp_seo',
|
||||
'order' => '2',
|
||||
),
|
||||
'kj_amp_seo_top_ad' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('kj_amp_seo_top_ad'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_amp_seo',
|
||||
'order' => '3',
|
||||
),
|
||||
'kj_amp_seo_middle_ad' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('kj_amp_seo_middle_ad'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_amp_seo',
|
||||
'order' => '4',
|
||||
),
|
||||
'kj_amp_seo_sticky_ad' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('kj_amp_seo_sticky_ad'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_amp_seo',
|
||||
'order' => '5',
|
||||
),
|
||||
|
||||
'kj_amp_seo_adsense_client' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('kj_amp_seo_adsense_client'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_amp_seo',
|
||||
'order' => '6',
|
||||
),
|
||||
);
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'CONFIG_KLJ_MENUS_KJ_AMP_SEO' => 'خيارات AMP سيو',
|
||||
'KJ_AMP_SEO_ENABLE' => 'تفعيل صفحات AMP المسرعة ',
|
||||
'KJ_AMP_SEO_SHARE_BUTTONS' => 'عرض أزرار المشاركة',
|
||||
'KJ_AMP_SEO_TOP_AD' => 'كود slot لإعلان AMP أدسنس علوي، دعه فارغ للتعطيل',
|
||||
'KJ_AMP_SEO_MIDDLE_AD' => 'كود slot لإعلان AMP أدسنس وسطي، دعه فارغ للتعطيل',
|
||||
'KJ_AMP_SEO_STICKY_AD' => 'كود slot لإعلان AMP أدسنس لاصق، دعه فارغ للتعطيل',
|
||||
'KJ_AMP_SEO_ADSENSE_CLIENT' => 'كود client العام لحساب ادسنس الخاص بالإعلانات',
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'CONFIG_KLJ_MENUS_KJ_AMP_SEO' => 'AMP SEO Options',
|
||||
'KJ_AMP_SEO_ENABLE' => 'Enable fast AMP pages',
|
||||
'KJ_AMP_SEO_SHARE_BUTTONS' => 'Enable social share buttons',
|
||||
'KJ_AMP_SEO_TOP_AD' => 'Slot code for Top AdSense AMP ad, keep it empty to disable',
|
||||
'KJ_AMP_SEO_MIDDLE_AD' => 'Slot code for Middle AdSense AMP ad, keep it empty to disable',
|
||||
'KJ_AMP_SEO_STICKY_AD' => 'Slot code for Sticky AdSense AMP ad, keep it empty to disable',
|
||||
'KJ_AMP_SEO_ADSENSE_CLIENT' => 'Client code for AdSense ads',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['kj_amp_seo']['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_amp_seo']['uninstall'] = function ($plg_id) {
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'kj_amp_seo_enable',
|
||||
'kj_amp_seo_share_buttons',
|
||||
'kj_amp_seo_top_ad',
|
||||
'kj_amp_seo_middle_ad',
|
||||
'kj_amp_seo_sticky_ad',
|
||||
'kj_amp_seo_adsense_client',
|
||||
));
|
||||
|
||||
|
||||
//delete language variables
|
||||
foreach (['ar', 'en'] as $language) {
|
||||
delete_olang(null, $language, $plg_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# plugin functions
|
||||
$kleeja_plugin['kj_amp_seo']['functions'] = array(
|
||||
'Saaheader_links_func' => function ($args) {
|
||||
if(defined('IN_DOWNLOAD') && !ig('amp_page')){
|
||||
global $config;
|
||||
$current_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
$current_url .= strpos($current_url, '?') === false ? '?' : '&';
|
||||
|
||||
$current_url .= 'amp_page=1';
|
||||
|
||||
$extra = $args['extra'] . '<link rel="amphtml" href="'.htmlspecialchars($current_url).'">';
|
||||
return compact('extra');
|
||||
}
|
||||
},
|
||||
|
||||
'b4_showsty_downlaod_id_filename' => function($args){
|
||||
|
||||
|
||||
if(!ig('amp_page')){
|
||||
return;
|
||||
}
|
||||
|
||||
global $tpl, $lang;
|
||||
|
||||
extract($args);
|
||||
|
||||
$dir = $lang['DIR'];
|
||||
|
||||
$side_menu = array(
|
||||
1 => array('name' => 'profile', 'title' => $lang['PROFILE'], 'url' => $config['mod_writer'] ? 'profile.html' : 'ucp.php?go=profile', 'show' => $user_is),
|
||||
2 => array('name' => 'fileuser', 'title' => $lang['YOUR_FILEUSER'], 'url' => $config['mod_writer'] ? 'fileuser.html' : 'ucp.php?go=fileuser', 'show' => $config['enable_userfile'] && user_can('access_fileuser')),
|
||||
3 => $user_is
|
||||
? array('name' => 'logout', 'title' => $lang['LOGOUT'], 'url' => $config['mod_writer'] ? 'logout.html' : 'ucp.php?go=logout', 'show' => true)
|
||||
: array('name' => 'login', 'title' => $lang['LOGIN'], 'url' => $config['mod_writer'] ? 'login.html' : 'ucp.php?go=login', 'show' => true),
|
||||
4 => array('name' => 'register', 'title' => $lang['REGISTER'], 'url' => $config['mod_writer'] ? 'register.html' : 'ucp.php?go=register', 'show' => !$user_is && $config['register']),
|
||||
);
|
||||
|
||||
$top_menu = array(
|
||||
1 => array('name' => 'index', 'title' => $lang['INDEX'], 'url' => $config['siteurl'], 'show' => true),
|
||||
2 => array('name' => 'rules', 'title' => $lang['RULES'], 'url' => $config['mod_writer'] ? 'rules.html' : 'go.php?go=rules', 'show' => true),
|
||||
3 => array('name' => 'guide', 'title' => $lang['GUIDE'], 'url' => $config['mod_writer'] ? 'guide.html' : 'go.php?go=guide', 'show' => true),
|
||||
4 => array('name' => 'stats', 'title' => $lang['STATS'], 'url' => $config['mod_writer'] ? 'stats.html' : 'go.php?go=stats', 'show' => $config['allow_stat_pg'] && user_can('access_stats')),
|
||||
5 => array('name' => 'report', 'title' => $lang['REPORT'], 'url' => $config['mod_writer'] ? 'report.html' : 'go.php?go=report', 'show' => user_can('access_report')),
|
||||
6 => array('name' => 'call', 'title' => $lang['CALL'], 'url' => $config['mod_writer'] ? 'call.html' : 'go.php?go=call', 'show' => user_can('access_call')),
|
||||
);
|
||||
|
||||
$tpl->assign("side_menu", $side_menu);
|
||||
$tpl->assign("top_menu", $top_menu);
|
||||
$tpl->assign("dir", $dir);
|
||||
|
||||
|
||||
|
||||
$current_url = 'http://'.$_SERVER['HTTP_HOST']
|
||||
. preg_replace('/[\&|\?|\/]amp_page=\d/', '', $_SERVER['REQUEST_URI']);
|
||||
|
||||
$tpl->assign("amp_canonical", $current_url);
|
||||
|
||||
|
||||
//ads
|
||||
$tpl->assign("top_ad", trim($config['kj_amp_seo_top_ad']) == '' ? false : trim($config['kj_amp_seo_top_ad']));
|
||||
$tpl->assign("middle_ad", trim($config['kj_amp_seo_middle_ad']) == '' ? false : trim($config['kj_amp_seo_middle_ad']));
|
||||
$tpl->assign("sticky_ad", trim($config['kj_amp_seo_sticky_ad']) == '' ? false : trim($config['kj_amp_seo_sticky_ad']));
|
||||
$tpl->assign("adsense_client", trim($config['kj_amp_seo_adsense_client']));
|
||||
|
||||
header('Content-type: text/html; charset=UTF-8');
|
||||
header('Cache-Control: private, no-cache="set-cookie"');
|
||||
header('Pragma: no-cache');
|
||||
header('x-frame-options: SAMEORIGIN');
|
||||
header('x-xss-protection: 1; mode=block');
|
||||
|
||||
echo $tpl->display('amp', __DIR__);
|
||||
|
||||
return ['show' => false];
|
||||
}
|
||||
);
|
||||
|
||||
|
Before Width: | Height: | Size: 9.9 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,128 +0,0 @@
|
||||
<?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.9',
|
||||
# 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']);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
Before Width: | Height: | Size: 96 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,130 +0,0 @@
|
||||
<?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.9',
|
||||
# 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 language variables
|
||||
foreach (['ar', 'en'] as $language) {
|
||||
delete_olang(null, $language, $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');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
|
||||
|
||||
<!-- Breadcrumbs -->
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="./">{lang.R_CPINDEX}</a></li>
|
||||
<li class="breadcrumb-item">{olang.R_KJ_FTP_OPTIONS}</li>
|
||||
</ol>
|
||||
|
||||
<a href="#" class="btn btn-primary pull-(lang.DIR==ltr?right:left)" data-toggle="modal" data-target="#account_add_new">
|
||||
<i class="fa fa-plus-circle"></i> {olang.KJ_FTP_ADD_NEW_ACCOUNT}
|
||||
</a>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
|
||||
<div id="accordion" class="mt-3" role="tablist" aria-multiselectable="true">
|
||||
|
||||
<LOOP NAME="ftp_accounts">
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header" role="tab" id="heading{{id}}">
|
||||
<h5 class="mb-0">
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#collapse{{id}}" aria-expanded="true" aria-controls="collapse{{id}}" style="text-decoration: none">
|
||||
<IF LOOP="active">
|
||||
<i class="fa fa-check text-success" title="{olang.KJ_FTP_OPT_ACTIVE}" data-toggle="tooltip"></i>
|
||||
<ELSE>
|
||||
<i class="fa fa-pause-circle text-gray-dark"></i>
|
||||
</IF>
|
||||
<small class="badge badge-pill badge-dark">{{name}}</small> {{host}}
|
||||
</a>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="collapse{{id}}" class="collapse " role="tabpanel" aria-labelledby="heading{{id}}">
|
||||
<div class="card-body">
|
||||
|
||||
<!-- edit form -->
|
||||
<form method="post" action="{action}">
|
||||
|
||||
<input type="hidden" value="{{id}}" name="id">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">{olang.KJ_FTP_OPT_NAME}</label>
|
||||
<input type="text" class="form-control" name="name" id="name" aria-describedby="nameHelp" placeholder="" value="{{name}}">
|
||||
<small id="nameHelp" class="form-text text-muted">{olang.KJ_FTP_OPT_NAME_HELP}</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="host">{olang.KJ_FTP_OPT_HOST}</label>
|
||||
<input type="text" class="form-control" name="host" id="host" placeholder="" aria-describedby="hostHelp" value="{{host}}">
|
||||
<small id="hostHelp" class="form-text text-muted">{olang.KJ_FTP_OPT_HOST_HELP}</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="username">{olang.KJ_FTP_OPT_USERNAME}</label>
|
||||
<input type="text" class="form-control" name="username" id="username" placeholder="" value="{{username}}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">{olang.KJ_FTP_OPT_PASSWORD}</label>
|
||||
<input type="text" class="form-control" name="password" id="password" placeholder="" value="">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="port">{olang.KJ_FTP_OPT_PORT}</label>
|
||||
<input type="text" class="form-control" name="port" id="port" placeholder="" value="{{port}}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="root">{olang.KJ_FTP_OPT_ROOT}</label>
|
||||
<input type="text" class="form-control" name="root" id="root" placeholder="" value="{{root}}">
|
||||
<small id="rootHelp" class="form-text text-muted">{olang.KJ_FTP_OPT_ROOT_HELP}</small>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="link">{olang.KJ_FTP_OPT_LINK}</label>
|
||||
<input type="text" class="form-control" name="link" id="link" placeholder="" value="{{link}}">
|
||||
<small id="linkHelp" class="form-text text-muted">{olang.KJ_FTP_OPT_LINK_HELP}</small>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<label class="form-check-label">
|
||||
<input type="checkbox" class="form-check-input" name="passive"<IF LOOP="passive"> checked="checked"</IF>>
|
||||
Passive
|
||||
</label>
|
||||
|
||||
<small id="passiveHelp" class="form-text text-muted">{olang.KJ_FTP_OPT_PASSIVE_HELP}</small>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<label class="form-check-label">
|
||||
<input type="checkbox" class="form-check-input" name="active"<IF LOOP="active"> checked="checked"</IF>>
|
||||
{olang.KJ_FTP_OPT_ACTIVE}
|
||||
</label>
|
||||
|
||||
<small id="activeHelp" class="form-text text-muted">{olang.KJ_FTP_OPT_ACTIVE_HELP}</small>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-check">
|
||||
<label class="form-check-label">
|
||||
<input type="checkbox" class="form-check-input" name="ssl"<IF LOOP="ssl"> checked="checked"</IF>>
|
||||
SSL
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<input type="submit" name="submit" class="btn btn-primary mt-2" value="{lang.UPDATE}">
|
||||
<input type="hidden" name="type" value="edit">
|
||||
|
||||
{H_FORM_KEYS}
|
||||
|
||||
</form>
|
||||
<!-- end edit form-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</LOOP>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- new account modal -->
|
||||
<div id="account_add_new" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="addNewAccount" aria-hidden="true">
|
||||
|
||||
<form method="post" action="{action}" id="add_account_form">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="addNewAccount">{olang.KJ_FTP_ADD_NEW_ACCOUNT}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="alert alert-info">
|
||||
{olang.KJ_FTP_ADD_NEW_ACCOUNT_EXP}
|
||||
</div>
|
||||
|
||||
{H_FORM_KEYS}
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="hidden" name="type" value="new">
|
||||
<input type="submit" name="submit" class="btn btn-primary" value="{lang.YES}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- end new account modal -->
|
||||
@@ -1,374 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Kleeja
|
||||
* @copyright (c) 2007 Kleeja.com
|
||||
* @license http://www.kleeja.com/license
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_COMMON'))
|
||||
{
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make changes with files using FTP
|
||||
*/
|
||||
class kleeja_ftp
|
||||
{
|
||||
/**
|
||||
* TimeOut before disconnection
|
||||
*/
|
||||
public $timeout = 30;
|
||||
/**
|
||||
* Move to this folder after connection
|
||||
*/
|
||||
public $root = '';
|
||||
/**
|
||||
* If enabled, debug mode will be activated
|
||||
*/
|
||||
public $debug = false;
|
||||
/**
|
||||
* FTP current connection handler
|
||||
*/
|
||||
private $handler = null;
|
||||
|
||||
|
||||
private $unique_name = '';
|
||||
|
||||
private $link = '';
|
||||
|
||||
/**
|
||||
* Connect to FTP server
|
||||
*
|
||||
* @param string $host FTP server address
|
||||
* @param string $user FTP server username
|
||||
* @param string $password FTP server password
|
||||
* @param int $port FTP server port
|
||||
* @param string $rootPath
|
||||
* @param bool $passive
|
||||
* @return bool|kleeja_ftp
|
||||
* @internal param string $path FTP server path
|
||||
*/
|
||||
public function open($host, $user, $password, $port = 21, $rootPath = '/', $passive = true, $ssl = false, $timeout = 90)
|
||||
{
|
||||
$this->timeout = $timeout;
|
||||
|
||||
$this->debug = defined('DEV_STAGE');
|
||||
|
||||
|
||||
#connect to the server
|
||||
if($ssl)
|
||||
{
|
||||
$this->handler = @ftp_ssl_connect($host, $port, $this->timeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->handler = @ftp_connect($host, $port, $this->timeout);
|
||||
}
|
||||
|
||||
|
||||
if (!$this->handler)
|
||||
{
|
||||
// if($this->debug)
|
||||
// {
|
||||
// echo 'can not connect<br>';
|
||||
// var_dump($this->handler);
|
||||
//
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
#pasv mode
|
||||
@ftp_pasv($this->handler, $passive);
|
||||
|
||||
|
||||
#login to the server
|
||||
if (!ftp_login($this->handler, $user, $password))
|
||||
{
|
||||
// if($this->debug)
|
||||
// {
|
||||
// echo 'can not login<br>';
|
||||
// var_dump($this->handler);
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
#move to the path
|
||||
|
||||
|
||||
$rootPath = trim($rootPath);
|
||||
|
||||
if($rootPath == '/')
|
||||
{
|
||||
$rootPath = '';
|
||||
}
|
||||
|
||||
|
||||
if ($rootPath != '')
|
||||
{
|
||||
if (substr($rootPath, -1, 1) == '/')
|
||||
{
|
||||
$rootPath = substr($rootPath, 0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->root = $rootPath;
|
||||
|
||||
if($this->root != '')
|
||||
{
|
||||
$this->link = 'http://' . $host . '/' . ltrim($rootPath, '/');
|
||||
|
||||
if (!$this->file_exists($this->root))
|
||||
{
|
||||
$this->create_folder('');
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Go to the given folder
|
||||
* @param string $dir
|
||||
* @return bool
|
||||
*/
|
||||
public function go_to($dir = '')
|
||||
{
|
||||
if ($dir && $dir !== '/')
|
||||
{
|
||||
if (substr($dir, -1, 1) == '/')
|
||||
{
|
||||
$dir = substr($dir, 0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
return @ftp_chdir($this->handler, $dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close current FTP connection
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
if (!$this->handler)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ftp_quit($this->handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current folder that we are in now
|
||||
* @return string
|
||||
*/
|
||||
public function current_folder()
|
||||
{
|
||||
return ftp_pwd($this->handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the file or folder permission
|
||||
* @param string $file
|
||||
* @param int $perm
|
||||
* @return bool
|
||||
*/
|
||||
public function chmod($file, $perm = 0644)
|
||||
{
|
||||
if (function_exists('ftp_chmod'))
|
||||
{
|
||||
$action = @ftp_chmod($this->handler, $perm, $this->_fixpath($file));
|
||||
}
|
||||
else
|
||||
{
|
||||
$chmod_cmd = 'CHMOD ' . base_convert($perm, 10, 8) . ' ' . $this->_fixpath($file);
|
||||
$action = ftp_site($this->handler, $chmod_cmd);
|
||||
}
|
||||
return $action;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* is file exists
|
||||
* @return bool
|
||||
*/
|
||||
public function file_exists($file)
|
||||
{
|
||||
return ftp_size($this->handler, $this->_fixpath($file)) > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* fix the given path to be compatible with the FTP
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
private function _fixpath($path)
|
||||
{
|
||||
return ($this->root != '' ? $this->root . '/' : '') . $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete given file
|
||||
* @param string $file
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($file)
|
||||
{
|
||||
return @ftp_delete($this->handler, $this->_fixpath($file));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a file and write the given content to it
|
||||
* @param string $filePath
|
||||
* @param $content
|
||||
* @return bool
|
||||
*/
|
||||
public function write($filePath, $content)
|
||||
{
|
||||
$cached_file = PATH . 'cache/cached_ftp_' . uniqid(time());
|
||||
|
||||
#make it as a cached file
|
||||
$h = @fopen($cached_file, 'wb');
|
||||
fwrite($h, $content);
|
||||
@fclose($h);
|
||||
|
||||
|
||||
$r = @ftp_put($this->handler, $this->_fixpath($filePath), $cached_file, FTP_BINARY);
|
||||
|
||||
|
||||
kleeja_unlink($cached_file, true);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a local file to the FTP server
|
||||
* @param string $local_file
|
||||
* @param string $server_file
|
||||
* @return bool
|
||||
*/
|
||||
public function upload($local_file, $server_file, $deleteLocal = true)
|
||||
{
|
||||
#Initate the upload
|
||||
#TODO if slow, use ftp_put
|
||||
$ret = ftp_nb_put($this->handler, $this->_fixpath($server_file), $local_file, FTP_BINARY);
|
||||
while ($ret == FTP_MOREDATA)
|
||||
{
|
||||
#still uploading
|
||||
if($this->debug)
|
||||
{
|
||||
print ftell($this->handler)."\n";
|
||||
}
|
||||
|
||||
$ret = ftp_nb_continue($this->handler);
|
||||
}
|
||||
|
||||
if($deleteLocal)
|
||||
{
|
||||
kleeja_unlink($local_file);
|
||||
}
|
||||
|
||||
#bad uploading
|
||||
if ($ret != FTP_FINISHED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a file
|
||||
* @param string $old_file
|
||||
* @param string $new_file
|
||||
* @return bool
|
||||
*/
|
||||
public function rename($old_file, $new_file)
|
||||
{
|
||||
return @ftp_rename($this->handler, $this->_fixpath($old_file), $this->_fixpath($new_file));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a folder
|
||||
* @param string $dir
|
||||
* @param int $perm
|
||||
* @return bool
|
||||
*/
|
||||
public function create_folder($dir, $perm = 0755)
|
||||
{
|
||||
// if($this->debug)
|
||||
// {
|
||||
// var_dump($this->_fixpath($dir));
|
||||
// }
|
||||
|
||||
if(ftp_mkdir($this->handler, $this->_fixpath($dir)) === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->chmod($this->_fixpath($dir), $perm);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given folder
|
||||
* @param string $dir
|
||||
* @return bool
|
||||
*/
|
||||
public function delete_folder($dir)
|
||||
{
|
||||
return @ftp_rmdir($this->handler, $this->_fixpath($dir));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $unique_name
|
||||
*/
|
||||
public function setUniqueName($unique_name)
|
||||
{
|
||||
$this->unique_name = $unique_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUniqueName()
|
||||
{
|
||||
return $this->unique_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $link
|
||||
*/
|
||||
public function setLink($link)
|
||||
{
|
||||
if(trim($link) == '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (substr($link, -1, 1) == '/')
|
||||
{
|
||||
$link = substr($link, 0, -1);
|
||||
}
|
||||
|
||||
$this->link = $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLink($path)
|
||||
{
|
||||
return $this->link . '/' . $path;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,845 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
#includes important functions
|
||||
include_once PATH . '/includes/up_helpers/others.php';
|
||||
include_once PATH . '/includes/up_helpers/thumbs.php';
|
||||
include_once PATH . '/includes/up_helpers/watermark.php';
|
||||
include_once PATH . '/includes/up_helpers/remote_uploading.php';
|
||||
|
||||
|
||||
|
||||
class ftpUploader implements KleejaUploader
|
||||
{
|
||||
|
||||
protected $messages = array();
|
||||
|
||||
protected $allowed_file_extensions = array();
|
||||
|
||||
protected $upload_fields_limit = 0;
|
||||
|
||||
protected $total_uploaded_files = 0;
|
||||
|
||||
|
||||
/**
|
||||
* set the allowed extensions of uploaded files
|
||||
* @param array $allowed_file_extensions an array of allowed extensions, and sizes ['gif'=>122, 'png'=>2421 ..]
|
||||
* @return void
|
||||
*/
|
||||
function setAllowedFileExtensions($allowed_file_extensions)
|
||||
{
|
||||
$this->allowed_file_extensions = $allowed_file_extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the allowed extensions of uploaded files
|
||||
* @return array
|
||||
*/
|
||||
function getAllowedFileExtensions()
|
||||
{
|
||||
return $this->allowed_file_extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the allowed limit of the uploaded files
|
||||
* @param int $limit
|
||||
* @return void
|
||||
*/
|
||||
function setUploadFieldsLimit($limit)
|
||||
{
|
||||
$this->upload_fields_limit = $limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the allowed limit of the uploaded files
|
||||
* @return int
|
||||
*/
|
||||
function getUploadFieldsLimit()
|
||||
{
|
||||
return $this->upload_fields_limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* add an information message to output it to the user
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
function addInfoMessage($message)
|
||||
{
|
||||
array_push($this->messages, array($message, 'info'));
|
||||
}
|
||||
|
||||
/**
|
||||
* add an error message to output it to the user
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
function addErrorMessage($message)
|
||||
{
|
||||
array_push($this->messages, array($message, 'error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the messages
|
||||
* @return array
|
||||
*/
|
||||
function getMessages()
|
||||
{
|
||||
return $this->messages;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* save the file information to the database
|
||||
* @param array $fileInfo
|
||||
* @return void
|
||||
*/
|
||||
function saveToDatabase($fileInfo)
|
||||
{
|
||||
global $SQL, $dbprefix, $config;
|
||||
|
||||
// $fileInfo =
|
||||
// [
|
||||
// 'saveToFolder'
|
||||
// 'originalFileName'
|
||||
// 'generatedFileName'
|
||||
// 'fileSize'
|
||||
// 'currentUserId'
|
||||
// 'fileExtension
|
||||
// 'ftpName'
|
||||
// ];
|
||||
// + to be added in this method and goes to generateOutputBox
|
||||
// [
|
||||
// 'DeleteCode'
|
||||
// 'insertId'
|
||||
// [
|
||||
|
||||
|
||||
#sometime cant see file after uploading.. but ..
|
||||
getKleejaFtpInstance()->chmod($fileInfo['saveToFolder'] . '/' . $fileInfo['generatedFileName'], 0644);
|
||||
|
||||
|
||||
$fileInfo['DeleteCode'] = sha1($fileInfo['generatedFileName'] . uniqid());
|
||||
|
||||
$queryValues = array
|
||||
(
|
||||
'name' => $fileInfo['generatedFileName'],
|
||||
'real_filename' => $fileInfo['originalFileName'],
|
||||
'size' => intval($fileInfo['fileSize']),
|
||||
'time' => time(),
|
||||
'folder'=> 'ftp://' . $fileInfo['ftpName'] . ':' .$fileInfo['saveToFolder'],
|
||||
'type' => $fileInfo['fileExtension'],
|
||||
'user' => $fileInfo['currentUserId'],
|
||||
'code_del' => $fileInfo['DeleteCode'],
|
||||
'user_ip' => get_ip(),
|
||||
'id_form' => $config['id_form'],
|
||||
);
|
||||
|
||||
$is_img = in_array($fileInfo['fileExtension'], array('png','gif','jpg','jpeg', 'bmp')) ? true : false;
|
||||
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('ftpUploader_saveToDatabase_qr', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
|
||||
# insertion query
|
||||
$insert_query = array(
|
||||
'INSERT' => '`' . implode('` , `' , array_keys($queryValues)) . '`',
|
||||
'INTO' => "{$dbprefix}files",
|
||||
'VALUES' => "'" . implode("', '", array_map(array($SQL, 'escape'), array_values($queryValues))) . "'"
|
||||
);
|
||||
|
||||
|
||||
# do the query
|
||||
$SQL->build($insert_query);
|
||||
|
||||
|
||||
# inset id so it can be used in url like in do.php?id={id_for_url}
|
||||
$fileInfo['insertId'] = $SQL->insert_id();
|
||||
|
||||
|
||||
|
||||
# update Kleeja stats
|
||||
$update_query = array(
|
||||
'UPDATE' => "{$dbprefix}stats",
|
||||
'SET' => ($is_img ? "imgs=imgs+1" : "files=files+1") . ",sizes=sizes+" . intval($fileInfo['fileSize']) . ""
|
||||
);
|
||||
|
||||
$SQL->build($update_query);
|
||||
|
||||
|
||||
$this->generateOutputBox($fileInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate a box of the result and add it to addInfoMessage
|
||||
* @param array $fileInfo
|
||||
* @return void
|
||||
*/
|
||||
function generateOutputBox($fileInfo)
|
||||
{
|
||||
global $config, $lang;
|
||||
|
||||
// $fileInfo =
|
||||
// [
|
||||
// 'saveToFolder'
|
||||
// 'originalFileName'
|
||||
// 'generatedFileName'
|
||||
// 'fileSize'
|
||||
// 'currentUserId'
|
||||
// 'fileExtension
|
||||
// 'DeleteCode'
|
||||
// 'insertId'
|
||||
// [
|
||||
|
||||
|
||||
$is_img = in_array($fileInfo['fileExtension'], array('png','gif','jpg','jpeg', 'bmp')) ? true : false;
|
||||
|
||||
|
||||
# information of file, used for generating a url boxes
|
||||
$file_info = array(
|
||||
'::ID::' => $fileInfo['insertId'],
|
||||
'::NAME::' => $fileInfo['generatedFileName'],
|
||||
'::DIR::' => $fileInfo['saveToFolder'],
|
||||
'::FNAME::' => $fileInfo['originalFileName'],
|
||||
);
|
||||
|
||||
# show del code link box
|
||||
$extra_del = '';
|
||||
if ($config['del_url_file'])
|
||||
{
|
||||
$extra_del = get_up_tpl_box('del_file_code',
|
||||
array(
|
||||
'b_title' => $lang['URL_F_DEL'],
|
||||
'b_code_link' => kleeja_get_link('del', array('::CODE::'=>$fileInfo['DeleteCode']))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//show imgs
|
||||
if($is_img)
|
||||
{
|
||||
$img_html_result = '';
|
||||
|
||||
|
||||
$img_html_result .= get_up_tpl_box('image_thumb',
|
||||
array(
|
||||
'b_title' => $lang['URL_F_THMB'],
|
||||
'b_url_link'=> kleeja_get_link('image', $file_info),
|
||||
'b_img_link'=> kleeja_get_link('thumb', $file_info)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
#then show, image box
|
||||
$img_html_result .= get_up_tpl_box('image',
|
||||
array(
|
||||
'b_title' => $lang['URL_F_IMG'],
|
||||
'b_bbc_title'=> $lang['URL_F_BBC'],
|
||||
'b_url_link'=> kleeja_get_link('image', $file_info),
|
||||
)
|
||||
);
|
||||
|
||||
#add del link box to the result if there is any
|
||||
$img_html_result .= $extra_del;
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('ftpUploader_generateOutputBox_image_result', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
|
||||
#show success message
|
||||
$this->addInfoMessage(
|
||||
'<div class="up-box-title">'. $lang['IMG_DOWNLAODED'] . ': ' .
|
||||
htmlspecialchars($fileInfo['originalFileName']) . '</div>' . "\n" .
|
||||
$img_html_result
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
#then show other files
|
||||
$else_html_result = get_up_tpl_box('file',
|
||||
array(
|
||||
'b_title' => $lang['URL_F_FILE'],
|
||||
'b_bbc_title'=> $lang['URL_F_BBC'],
|
||||
'b_url_link'=> kleeja_get_link('file', $file_info),
|
||||
)
|
||||
);
|
||||
#add del link box to the result if there is any
|
||||
$else_html_result .= $extra_del;
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('ftpUploader_generateOutputBox_file_result', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
|
||||
#show success message
|
||||
$this->addInfoMessage(
|
||||
'<div class="up-box-title">'. $lang['FILE_DOWNLAODED']. ': '
|
||||
. htmlspecialchars($fileInfo['originalFileName']) . '</div>' . "\n" .
|
||||
$else_html_result
|
||||
);
|
||||
}
|
||||
|
||||
$this->total_uploaded_files++;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* here happens the magic, call this on upload submit
|
||||
* @param int $uploadType upload from files input or links
|
||||
* @todo watermark
|
||||
* @return void
|
||||
*/
|
||||
function upload($uploadType)
|
||||
{
|
||||
global $usrcp, $config, $lang;
|
||||
|
||||
# when $uploadType = 1, then we upload from _file input
|
||||
# if $uploadType = 2, then we uploading from url which is disabled by default and is buggy
|
||||
|
||||
|
||||
#upload to this folder
|
||||
$current_uploading_folder = $config['foldername'];
|
||||
|
||||
#current user id
|
||||
$current_user_id = $usrcp->name() ? $usrcp->id() : '-1';
|
||||
|
||||
|
||||
#is captcha is on?
|
||||
$captcha_enabled = intval($config['safe_code']);
|
||||
|
||||
$return_now = false;
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('ftpUploader_upload_1st', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
|
||||
# check folder our real folder
|
||||
if(!getKleejaFtpInstance()->file_exists($current_uploading_folder))
|
||||
{
|
||||
if(!$this->make_folder($current_uploading_folder))
|
||||
{
|
||||
$this->addErrorMessage($lang['CANT_DIR_CRT']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($return_now)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#no uploading yet, or just go to index.php, so we have make a new session
|
||||
if(!$uploadType)
|
||||
{
|
||||
unset($_SESSION['FIILES_NOT_DUPLI'], $_SESSION['FIILES_NOT_DUPLI_LINKS']);
|
||||
}
|
||||
|
||||
|
||||
# is captcha on, and there is uploading going on
|
||||
if($captcha_enabled && $uploadType)
|
||||
{
|
||||
#captcha is wrong
|
||||
if(!kleeja_check_captcha())
|
||||
{
|
||||
$this->addErrorMessage($lang['WRONG_VERTY_CODE']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# to prevent flooding, user must wait, waiting-time is grapped from Kleeja settings, admin is exceptional
|
||||
if(! user_can('enter_acp') && user_is_flooding($current_user_id))
|
||||
{
|
||||
$this->addErrorMessage(sprintf($lang['YOU_HAVE_TO_WAIT'],
|
||||
$current_user_id == '-1' ? $config['guestsectoupload'] : $config['usersectoupload']));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#detect flooding
|
||||
if ($uploadType == 1 && isset($_SESSION['FIILES_NOT_DUPLI']))
|
||||
{
|
||||
if(!empty($_SESSION['FIILES_NOT_DUPLI']) && $_SESSION['FIILES_NOT_DUPLI'] == sha1(serialize(array_column($_FILES, 'name'))))
|
||||
{
|
||||
unset($_SESSION['FIILES_NOT_DUPLI']);
|
||||
redirect('./');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($uploadType == 2 && isset($_SESSION['FIILES_NOT_DUPLI_LINKS']))
|
||||
{
|
||||
if($_SESSION['FIILES_NOT_DUPLI_LINKS'] == sha1(serialize($_POST)))
|
||||
{
|
||||
unset($_SESSION['FIILES_NOT_DUPLI_LINKS']);
|
||||
redirect('./');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# flooding code, making sure every ok session is cleared
|
||||
if ($uploadType == 1 && sizeof($_FILES) > 0)
|
||||
{
|
||||
$_SESSION['FIILES_NOT_DUPLI'] = sha1(serialize(array_column($_FILES, 'name')));
|
||||
}
|
||||
elseif($uploadType == 2)
|
||||
{
|
||||
$_SESSION['FIILES_NOT_DUPLI_LINKS'] = sha1(serialize($_POST));
|
||||
}
|
||||
|
||||
|
||||
#now close session to let user open any other page in Kleeja
|
||||
session_write_close();
|
||||
|
||||
|
||||
# do upload
|
||||
switch($uploadType)
|
||||
{
|
||||
#uploading from a _files input
|
||||
default:
|
||||
case 1:
|
||||
|
||||
if(!empty($_FILES['file']['tmp_name']))
|
||||
{
|
||||
$_FILES['file'][0] = $_FILES['file'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
# loop the uploaded files
|
||||
for($i=0; $i<=$this->getUploadFieldsLimit(); $i++)
|
||||
{
|
||||
//no file!
|
||||
if(empty($_FILES['file_' . $i . '_']['tmp_name']) && empty($_FILES['file'][$i]['tmp_name']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->uploadTypeFile($i, $current_uploading_folder, $current_user_id);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
#uploading from a url text-input
|
||||
case 2:
|
||||
|
||||
#if not enabled, quit it
|
||||
if($config['www_url'] != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
#loop text inputs
|
||||
for($i=0; $i<=$this->getUploadFieldsLimit(); $i++)
|
||||
{
|
||||
$this->uploadTypeUrl($i, $current_uploading_folder, $current_user_id);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
# well, no file uploaded, ask user to choose a file before submit
|
||||
if($this->total_uploaded_files == 0 && sizeof($this->messages) == 0)
|
||||
{
|
||||
$this->addErrorMessage($lang['CHOSE_F']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* upload a file from $_FILES
|
||||
* @param integer $fieldNumber as in file[i]
|
||||
* @param $current_uploading_folder
|
||||
* @param $current_user_id
|
||||
*/
|
||||
function uploadTypeFile($fieldNumber, $current_uploading_folder, $current_user_id)
|
||||
{
|
||||
global $config, $lang;
|
||||
|
||||
$fileInfo = array(
|
||||
'saveToFolder',
|
||||
'originalFileName',
|
||||
'generatedFileName',
|
||||
'fileSize',
|
||||
'currentUserId',
|
||||
'fileExtension'
|
||||
);
|
||||
|
||||
|
||||
$fileInfo['saveToFolder'] = $current_uploading_folder;
|
||||
$fileInfo['currentUserId'] = $current_user_id;
|
||||
|
||||
if(!isset($_FILES['file_' . $fieldNumber . '_']) && isset($_FILES['file'][$fieldNumber]))
|
||||
{
|
||||
$_FILES['file_' . $fieldNumber . '_'] = $_FILES['file'][$fieldNumber];
|
||||
}
|
||||
|
||||
# file name
|
||||
$fileInfo['originalFileName'] = isset($_FILES['file_' . $fieldNumber . '_']['name'])
|
||||
? htmlspecialchars(str_replace(array(';',','), '', $_FILES['file_' . $fieldNumber . '_']['name']))
|
||||
: '';
|
||||
|
||||
if(empty($fileInfo['originalFileName']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
# get the extension of file
|
||||
$fileInfo['fileExtension'] = strtolower(array_pop(explode('.', $fileInfo['originalFileName'])));
|
||||
|
||||
|
||||
# them the size
|
||||
$fileInfo['fileSize'] = !empty($_FILES['file_' . $fieldNumber . '_']['size'])
|
||||
? intval($_FILES['file_' . $fieldNumber . '_']['size'])
|
||||
: 0;
|
||||
|
||||
|
||||
# get the other filename, changed depend on kleeja settings
|
||||
$fileInfo['generatedFileName'] = change_filename_decoding($fileInfo['originalFileName'], $fieldNumber, $fileInfo['fileExtension']);
|
||||
|
||||
|
||||
# filename templates {rand:..}, {date:..}
|
||||
$fileInfo['generatedFileName'] = change_filename_templates(trim($config['prefixname']) . $fileInfo['generatedFileName']);
|
||||
|
||||
|
||||
# file exists before? change it a little
|
||||
if(getKleejaFtpInstance()->file_exists($current_uploading_folder . '/' . $fileInfo['generatedFileName']))
|
||||
{
|
||||
$fileInfo['generatedFileName'] = change_filename_decoding(
|
||||
$fileInfo['generatedFileName'],
|
||||
$fieldNumber, $fileInfo['fileExtension'],
|
||||
'exists'
|
||||
);
|
||||
}
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('ftpUploader_uploadTypeFile_1st', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
|
||||
# now, let process it
|
||||
if(!in_array(strtolower($fileInfo['fileExtension']), array_keys($this->getAllowedFileExtensions())))
|
||||
{
|
||||
# guest
|
||||
if($current_user_id == '-1')
|
||||
{
|
||||
$this->addErrorMessage(
|
||||
sprintf($lang['FORBID_EXT'], $fileInfo['fileExtension'])
|
||||
. '<br> <a href="' . ($config['mod_writer'] ? "register.html" : "ucp.php?go=register") .
|
||||
'" title="' . htmlspecialchars($lang['REGISTER']) . '">' . $lang['REGISTER'] . '</a>'
|
||||
);
|
||||
}
|
||||
# a member
|
||||
else
|
||||
{
|
||||
$this->addErrorMessage(sprintf($lang['FORBID_EXT'], $fileInfo['fileExtension']));
|
||||
}
|
||||
}
|
||||
# bad chars in the filename
|
||||
elseif(preg_match ("#[\\\/\:\*\?\<\>\|\"]#", $fileInfo['generatedFileName']))
|
||||
{
|
||||
$this->addErrorMessage(sprintf($lang['WRONG_F_NAME'], htmlspecialchars($_FILES['file_' . $fieldNumber . '_']['name'])));
|
||||
}
|
||||
# check file extension for bad stuff
|
||||
elseif(ext_check_safe($_FILES['file_' . $fieldNumber . '_']['name']) == false)
|
||||
{
|
||||
$this->addErrorMessage(sprintf($lang['WRONG_F_NAME'], htmlspecialchars($_FILES['file_' . $fieldNumber . '_']['name'])));
|
||||
}
|
||||
# check the mime-type for the file
|
||||
elseif(check_mime_type($_FILES['file_' . $fieldNumber . '_']['type'], $fileInfo['fileExtension'], $_FILES['file_' . $fieldNumber . '_']['tmp_name']) == false)
|
||||
{
|
||||
$this->addErrorMessage(sprintf($lang['NOT_SAFE_FILE'], htmlspecialchars($_FILES['file_' . $fieldNumber . '_']['name'])));
|
||||
}
|
||||
# check file size
|
||||
elseif($this->getAllowedFileExtensions()[$fileInfo['fileExtension']] > 0
|
||||
&& $fileInfo['fileSize'] >= $this->getAllowedFileExtensions()[$fileInfo['fileExtension']])
|
||||
{
|
||||
$this->addErrorMessage(sprintf(
|
||||
$lang['SIZE_F_BIG'],
|
||||
htmlspecialchars($_FILES['file_' . $fieldNumber . '_']['name']),
|
||||
readable_size($this->getAllowedFileExtensions()[$fileInfo['fileExtension']]))
|
||||
);
|
||||
}
|
||||
# no errors, so upload it
|
||||
else
|
||||
{
|
||||
|
||||
$is_img = in_array($fileInfo['fileExtension'], array('png','gif','jpg','jpeg', 'bmp')) ? true : false;
|
||||
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('ftpUploader_uploadTypeFile_2nd', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
#cache it locally for now
|
||||
$localFile = PATH . 'cache/' . uniqid(time()) . '.' . $fileInfo['fileExtension'];
|
||||
|
||||
|
||||
# now, upload the file
|
||||
$file = move_uploaded_file($_FILES['file_' . $fieldNumber . '_']['tmp_name'], $localFile);
|
||||
|
||||
if ($file)
|
||||
{
|
||||
//watermark + thumbnail
|
||||
if($is_img)
|
||||
{
|
||||
$this->generateThumbnail(
|
||||
$localFile,
|
||||
$fileInfo['fileExtension'],
|
||||
$current_uploading_folder . '/thumbs/' . $fileInfo['generatedFileName']
|
||||
);
|
||||
}
|
||||
|
||||
if($config['write_imgs'] != 0)
|
||||
{
|
||||
$this->generateWatermark($localFile, $fileInfo['fileExtension']);
|
||||
}
|
||||
|
||||
|
||||
getKleejaFtpInstance()->upload($localFile, $current_uploading_folder . "/" . $fileInfo['generatedFileName']);
|
||||
|
||||
|
||||
$fileInfo['ftpName'] = getKleejaFtpInstance()->getUniqueName();
|
||||
|
||||
$this->saveToDatabase($fileInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->addErrorMessage(sprintf($lang['CANT_UPLAOD'], $fileInfo['originalFileName']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* upload a file from a URL
|
||||
* @param $fieldNumber
|
||||
* @param $current_uploading_folder
|
||||
* @param $current_user_id
|
||||
*/
|
||||
function uploadTypeUrl($fieldNumber, $current_uploading_folder, $current_user_id)
|
||||
{
|
||||
global $config, $lang;
|
||||
|
||||
$fileInfo = array(
|
||||
'saveToFolder',
|
||||
'originalFileName',
|
||||
'generatedFileName',
|
||||
'fileSize',
|
||||
'currentUserId',
|
||||
'fileExtension'
|
||||
);
|
||||
|
||||
|
||||
$fileInfo['saveToFolder'] = $current_uploading_folder;
|
||||
$fileInfo['currentUserId'] = $current_user_id;
|
||||
|
||||
|
||||
if(p('file_' . $fieldNumber . '_') == '' || p('file_' . $fieldNumber . '_') == $lang['PAST_URL_HERE'])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# get file name
|
||||
$fileInfo['originalFileName'] = basename(p('file_' . $fieldNumber . '_'));
|
||||
|
||||
|
||||
# file extension, type
|
||||
$fileExtensions = array_map('strtolower', explode(".", $fileInfo['originalFileName']));
|
||||
|
||||
|
||||
if(sizeof($fileExtensions) > 1 && in_array($fileExtensions[sizeof($fileExtensions)-1], array('html', 'php', 'html')))
|
||||
{
|
||||
$fileInfo['fileExtension'] = strtolower($fileExtensions[sizeof($fileExtensions)-2]);
|
||||
}
|
||||
else if(sizeof($fileExtensions) > 0)
|
||||
{
|
||||
$fileInfo['fileExtension'] = strtolower($fileExtensions[sizeof($fileExtensions)-1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$fileInfo['fileExtension'] = ''; //what to do?
|
||||
}
|
||||
|
||||
|
||||
# change to another filename depend on kleeja settings
|
||||
$fileInfo['generatedFileName'] = change_filename_decoding($fileInfo['originalFileName'], $fieldNumber, $fileInfo['fileExtension']);
|
||||
$fileInfo['generatedFileName'] = change_filename_templates(trim($config['prefixname']) . $fileInfo['generatedFileName']);
|
||||
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('ftpUploader_uploadTypeUrl_1st', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
|
||||
#forbbiden type ? quit it
|
||||
if(!in_array(strtolower($fileInfo['fileExtension']), array_keys($this->getAllowedFileExtensions())))
|
||||
{
|
||||
if($current_user_id == '-1')
|
||||
{
|
||||
$this->addErrorMessage(
|
||||
sprintf($lang['FORBID_EXT'], $fileInfo['fileExtension']) .
|
||||
'<br> <a href="' . ($config['mod_writer'] ? "register.html" : "ucp.php?go=register") . '">' .
|
||||
$lang['REGISTER'] . '</a>'
|
||||
);
|
||||
}
|
||||
# a member
|
||||
else
|
||||
{
|
||||
$this->addErrorMessage(sprintf($lang['FORBID_EXT'], $fileInfo['fileExtension']));
|
||||
}
|
||||
}
|
||||
# file exists before ? quit it
|
||||
elseif(getKleejaFtpInstance()->file_exists($current_uploading_folder . '/' . $fileInfo['generatedFileName']))
|
||||
{
|
||||
$fileInfo['generatedFileName'] = change_filename_decoding(
|
||||
$fileInfo['generatedFileName'],
|
||||
$fieldNumber, $fileInfo['fileExtension'],
|
||||
'exists'
|
||||
);
|
||||
}
|
||||
# no errors, ok, lets upload now
|
||||
else
|
||||
{
|
||||
|
||||
$is_img = in_array($fileInfo['fileExtension'], array('png','gif','jpg','jpeg', 'bmp')) ? true : false;
|
||||
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('ftpUploader_uploadTypeUrl_2nd', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
|
||||
#no prefix ? http or even ftp, then add one
|
||||
if(!in_array(strtolower(substr(p('file_' . $fieldNumber . '_'), 0, 4)), array('http', 'ftp:')))
|
||||
{
|
||||
$_POST['file_' . $fieldNumber . '_'] = 'http://' . p('file_' . $fieldNumber . '_');
|
||||
}
|
||||
|
||||
#get size, if big quit it
|
||||
$fileInfo['fileSize'] = get_remote_file_size(p('file_' . $fieldNumber . '_'));
|
||||
|
||||
if($this->getAllowedFileExtensions()[$fileInfo['fileExtension']] > 0 && $fileInfo['fileSize'] >= $this->getAllowedFileExtensions()[$fileInfo['fileExtension']])
|
||||
{
|
||||
$this->addErrorMessage(sprintf(
|
||||
$lang['SIZE_F_BIG'],
|
||||
p('file_' . $fieldNumber . '_'),
|
||||
readable_size($this->getAllowedFileExtensions()[$fileInfo['fileExtension']])
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#cache it locally for now
|
||||
$localFile = PATH . 'cache/' . uniqid(time()) . '.' . $fileInfo['fileExtension'];
|
||||
|
||||
#get remote data, if no data quit it
|
||||
$data = fetch_remote_file(
|
||||
p('file_' . $fieldNumber . '_'),
|
||||
$localFile,
|
||||
15,
|
||||
false,
|
||||
2,
|
||||
true
|
||||
);
|
||||
|
||||
if($data === false)
|
||||
{
|
||||
$this->addErrorMessage($lang['URL_CANT_GET']);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//watermark + thumbnail
|
||||
if($is_img)
|
||||
{
|
||||
$this->generateThumbnail(
|
||||
$localFile,
|
||||
$fileInfo['fileExtension'],
|
||||
$current_uploading_folder . '/thumbs/' . $fileInfo['generatedFileName']
|
||||
);
|
||||
|
||||
if($config['write_imgs'] != 0)
|
||||
{
|
||||
$this->generateWatermark($localFile, $fileInfo['fileExtension']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
getKleejaFtpInstance()->upload($localFile, $current_uploading_folder . "/" . $fileInfo['generatedFileName']);
|
||||
|
||||
|
||||
$fileInfo['ftpName'] = getKleejaFtpInstance()->getUniqueName();
|
||||
|
||||
$this->saveToDatabase($fileInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function generateThumbnail($source_path, $ext, $saveToThisFtpPath)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// var_dump($source_path);
|
||||
|
||||
# get default thumb dimensions
|
||||
$thmb_dim_w = $thmb_dim_h = 150;
|
||||
if(strpos($config['thmb_dims'], '*') !== false)
|
||||
{
|
||||
list($thmb_dim_w, $thmb_dim_h) = array_map('trim', explode('*', $config['thmb_dims']));
|
||||
}
|
||||
|
||||
|
||||
$localThumbFile = $source_path.'.thumb.'.$ext;
|
||||
|
||||
# generate a thumbnail
|
||||
helper_thumb($source_path, $ext, $localThumbFile, $thmb_dim_w, $thmb_dim_h);
|
||||
|
||||
|
||||
if(file_exists($localThumbFile))
|
||||
{
|
||||
getKleejaFtpInstance()->upload($localThumbFile, $saveToThisFtpPath);
|
||||
}
|
||||
}
|
||||
|
||||
function generateWatermark($localFile, $ext)
|
||||
{
|
||||
helper_watermark(
|
||||
$localFile,
|
||||
$ext
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function make_folder($folder)
|
||||
{
|
||||
#try to make a new upload folder
|
||||
|
||||
$folders = explode('/', $folder);
|
||||
|
||||
$path = '';
|
||||
foreach ($folders as $sub_folder)
|
||||
{
|
||||
getKleejaFtpInstance()->create_folder($path . $sub_folder);
|
||||
getKleejaFtpInstance()->create_folder($path . $sub_folder . '/thumbs');
|
||||
|
||||
|
||||
$this->generate_htaccess($path . $sub_folder);
|
||||
|
||||
$indexHtml = '<a href="http://kleeja.com"><p>KLEEJA ..</p></a>';
|
||||
|
||||
getKleejaFtpInstance()->write($path . $sub_folder . "/index.html", $indexHtml);
|
||||
getKleejaFtpInstance()->write($path . $sub_folder . "/thumbs/index.html", $indexHtml);
|
||||
|
||||
$path .= $sub_folder . '/';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function generate_htaccess($folder)
|
||||
{
|
||||
#data for the htaccess
|
||||
$htaccess_data = "<Files ~ \"^.*\.(php|php*|cgi|pl|phtml|shtml|sql|asp|aspx)\">\nOrder allow,deny\nDeny from all\n</Files>\n<IfModule mod_php4.c>\nphp_flag engine off\n</IfModule>\n<IfModule mod_php5.c>\nphp_flag engine off\n</IfModule>\nRemoveType .php .php* .phtml .pl .cgi .asp .aspx .sql";
|
||||
|
||||
getKleejaFtpInstance()->write($folder . "/.htaccess", $htaccess_data);
|
||||
getKleejaFtpInstance()->write($folder . "/thumbs/.htaccess", $htaccess_data);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 93 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,577 +0,0 @@
|
||||
<?php
|
||||
# kleeja plugin
|
||||
# kj_ftp
|
||||
# version: 1.0
|
||||
# developer: kleeja team
|
||||
|
||||
# prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
# 1- create_folder, generate htaccess: done
|
||||
# 2- kleeja_unlink: done
|
||||
|
||||
|
||||
|
||||
# plugin basic information
|
||||
$kleeja_plugin['kj_ftp']['information'] = array(
|
||||
# the casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'Kleeja Multi-FTP Uploading',
|
||||
'ar' => 'تحميل FTP متعدد'
|
||||
),
|
||||
# who is developing 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' => 'Add Multi-FTP support to Kleeja',
|
||||
'ar' => 'إضافة دعم التحميل لعدة FTP في كليجا'
|
||||
),
|
||||
# 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.9',
|
||||
# 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 required
|
||||
$kleeja_plugin['kj_ftp']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك إضافة الـFTP المتعدد لكليجا، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
$kleeja_plugin['kj_ftp']['first_run']['en'] = "
|
||||
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_ftp']['install'] = function ($plg_id) {
|
||||
global $dbprefix, $SQL;
|
||||
|
||||
//create table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS `{$dbprefix}kj_ftp_info` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(20) COLLATE utf8_bin DEFAULT NULL,
|
||||
`host` varchar(199) COLLATE utf8_bin DEFAULT NULL,
|
||||
`username` varchar(199) COLLATE utf8_bin DEFAULT NULL,
|
||||
`password` varchar(199) COLLATE utf8_bin DEFAULT NULL,
|
||||
`port` int(4) DEFAULT '21',
|
||||
`root` varchar(199) COLLATE utf8_bin DEFAULT '',
|
||||
`passive` tinyint(1) DEFAULT '1',
|
||||
`ssl` tinyint(1) DEFAULT '1',
|
||||
`timeout` int(4) DEFAULT '60',
|
||||
`link` varchar(199) COLLATE utf8_bin DEFAULT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`group` int(4) DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;";
|
||||
|
||||
$SQL->query($sql);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'R_KJ_FTP_OPTIONS' => 'تحميل الـFTP المتعدد',
|
||||
|
||||
#
|
||||
'KJ_FTP_OPT_NAME' => 'الإسم الثابت',
|
||||
'KJ_FTP_OPT_NAME_HELP' => 'كليجا تستخدم الإسم الثابت لحفظ وجلب الملفات، عند تغيير الإسم الثابت لن نستطيع جلب الملفات! عدل الإسم في حالة واحدة فقط، وهي لربط ملفات سابقة بحساب قديم تم حذفه.',
|
||||
'KJ_FTP_OPT_HOST' => 'الخادم',
|
||||
'KJ_FTP_OPT_HOST_HELP' => ' مثل: kleeja.com أو سب دومين sub.kleeja.com أو آي بي 188.54.12.11',
|
||||
'KJ_FTP_OPT_USERNAME' => 'اسم المستخدم',
|
||||
'KJ_FTP_OPT_PASSWORD' => 'كلمة المرور (مخفية، أكتب جديدة فقط لو أردت التغيير)',
|
||||
'KJ_FTP_OPT_PORT' => 'منفذ',
|
||||
'KJ_FTP_OPT_ROOT' => 'المسار الجذر',
|
||||
'KJ_FTP_OPT_ROOT_HELP' => 'المسار الذي ستقوم كليجا بإنشاء مجلد uploads داخله، غالباً دعه فارغ',
|
||||
'KJ_FTP_OPT_PASSIVE_HELP' => 'وضع FTP الآمن, قد يكون أبطئ',
|
||||
'KJ_FTP_OPT_ACTIVE' => 'مُفعل',
|
||||
'KJ_FTP_OPT_ACTIVE_HELP' => 'الحساب غير المفعل لن يستلم تحميلات جديدة ولكن سيتم جلب الملفات التي تم تحميلها مسبقاً منه.',
|
||||
|
||||
'KJ_FTP_OPT_LINK' => 'الرابط الفعلي',
|
||||
'KJ_FTP_OPT_LINK_HELP' => 'مثل: http://kleeja.com أو https://www.example.com/ftp1، لو ترك فارغاً سيتم إستخدام إنتاج رابط من الخادم ومجلد الروت.',
|
||||
|
||||
'KJ_FTP_ADD_NEW_ACCOUNT' => 'أضف حساب FTP جديد',
|
||||
'KJ_FTP_ADD_NEW_ACCOUNT_EXP' => ' هل أنت متأكد من إضافة حساب FTP جديد؟<br><small>يمكنك إضافة بيانات الحساب بعد الإضافة وتعديل الحساب.</small>',
|
||||
|
||||
'KJ_FTP_ACCOUNT_ADDED' => 'تم إضافة الحساب بنجاح',
|
||||
'KJ_FTP_ACCOUNT_UPDATED' => 'تم تحديث الحساب بنجاح',
|
||||
|
||||
'KJ_FTP_ACCOUNT_NAME_CONFLICT' => 'الأسم الثابت موجود في حساب آخر! لايمكنك إستخدام اسم ثابت واحد في حسابين',
|
||||
#
|
||||
|
||||
'KJ_FTP_NO_ACTIVE_ACCOUNTS_NOTE' => 'لآنه لايوجد أي حساب FTP تم تفعيله للتحميل، فإن كليجا ستستخدم نظام التحميل الإفتراضي المحلي. لجعل كليجا تقوم بالتحميل بإستخدام الإضافة، <a href="./?cp=kj_ftp_options">قم بتفعيل حساب FTP للتحميل</a> الآن!',
|
||||
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'R_KJ_FTP_OPTIONS' => 'KJ - Multi-FTP Uploading',
|
||||
|
||||
#
|
||||
'KJ_FTP_OPT_NAME' => 'Unique Name',
|
||||
'KJ_FTP_OPT_NAME_HELP' => 'Kleeja uses this name to identify that a file is related to this FTP account. Changing it will ruin the old files connection. Only edit this if you want to recover a connection of an old FTP account that has been deleted.',
|
||||
'KJ_FTP_OPT_HOST' => 'Host',
|
||||
'KJ_FTP_OPT_HOST_HELP' => ' Like: kleeja.com or a subdomain: sub.kleeja.com or an IP: 188.54.12.11',
|
||||
'KJ_FTP_OPT_USERNAME' => 'Username',
|
||||
'KJ_FTP_OPT_PASSWORD' => 'Password (hidden, type a new password only you want to change it)',
|
||||
'KJ_FTP_OPT_PORT' => 'Port',
|
||||
'KJ_FTP_OPT_ROOT' => 'Root Path',
|
||||
'KJ_FTP_OPT_ROOT_HELP' => 'The path where Kleeja will create "uploads" folder in. Usually keeping it empty is fine.',
|
||||
'KJ_FTP_OPT_PASSIVE_HELP' => 'Secure Passive FTP mode, slower.',
|
||||
|
||||
'KJ_FTP_OPT_ACTIVE' => 'Active',
|
||||
'KJ_FTP_OPT_ACTIVE_HELP' => 'Inactive account will not receive new uploads to it, but will continue serving previous upload from it.',
|
||||
|
||||
'KJ_FTP_OPT_LINK' => 'Direct Link',
|
||||
'KJ_FTP_OPT_LINK_HELP' => 'Link: http://kleeja.com or https://www.example.com/ftp1; If left empty, we will try to generate a link from the ftp host and given root folder.',
|
||||
|
||||
'KJ_FTP_ADD_NEW_ACCOUNT' => 'Add New FTP Account',
|
||||
'KJ_FTP_ADD_NEW_ACCOUNT_EXP' => 'Are you sure of adding a new FTP account? <br><small>You can edit the account information after adding it.</small>',
|
||||
|
||||
'KJ_FTP_ACCOUNT_ADDED' => 'The FTP account has been added successfully!',
|
||||
'KJ_FTP_ACCOUNT_UPDATED' => 'The FTP account has been updated successfully!',
|
||||
'KJ_FTP_ACCOUNT_NAME_CONFLICT' => 'The unique name is existed before, you can not have two accounts with same unique name!',
|
||||
|
||||
#
|
||||
'KJ_FTP_NO_ACTIVE_ACCOUNTS_NOTE' => 'Because you did not activate any FTP account, Kleeja will fallback to the default local uploading method. To make Kleeja Use FTP uploading method, <a href="./?cp=kj_ftp_options">activate an FTP account</a> now!',
|
||||
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['kj_ftp']['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_ftp']['uninstall'] = function ($plg_id) {
|
||||
//delete options
|
||||
// delete_config(array(
|
||||
// 'kj_ftp_home_meta_description',
|
||||
// 'kj_ftp_home_meta_keywords'
|
||||
// ));
|
||||
|
||||
//delete language variables
|
||||
foreach (['ar', 'en'] as $language) {
|
||||
delete_olang(null, $language, $plg_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# plugin functions
|
||||
$kleeja_plugin['kj_ftp']['functions'] = array(
|
||||
|
||||
//add to admin menu
|
||||
'begin_admin_page' => function ($args)
|
||||
{
|
||||
$adm_extensions = $args['adm_extensions'];
|
||||
$ext_icons = $args['ext_icons'];
|
||||
$adm_extensions[] = 'kj_ftp_options';
|
||||
$ext_icons['kj_ftp_options'] = 'cloud-upload';
|
||||
return compact('adm_extensions', 'ext_icons');
|
||||
},
|
||||
|
||||
'not_exists_kj_ftp_options' => function()
|
||||
{
|
||||
$include_alternative = dirname(__FILE__) . '/kj_ftp_options.php';
|
||||
|
||||
return compact('include_alternative');
|
||||
},
|
||||
|
||||
|
||||
'begin_index_page' => function()
|
||||
{
|
||||
if(defined('DISABLE_KLJ_FTP')){
|
||||
return;
|
||||
}
|
||||
|
||||
$uploadingMethodClass = dirname(__FILE__) . '/ftpUploader.php';
|
||||
|
||||
return compact('uploadingMethodClass');
|
||||
},
|
||||
|
||||
'kleeja_get_link_func2' => function($args)
|
||||
{
|
||||
if(defined('DISABLE_KLJ_FTP')){
|
||||
return;
|
||||
}
|
||||
|
||||
global $config;
|
||||
if(($args['pid'] == 'image' || $args['pid'] == 'thumb') && $config['id_form_img'] == 'direct'){
|
||||
|
||||
$realFolder = str_replace(array_keys($args['extra']), array_values($args['extra']), $args['links'][$args['pid']]);
|
||||
|
||||
$uniqueName = '';
|
||||
|
||||
if(strpos($realFolder, 'ftp://') !== false)
|
||||
{
|
||||
$afterFTP = explode('ftp://', $realFolder, 2);
|
||||
|
||||
|
||||
$folder = explode(':', $afterFTP[1], 2);
|
||||
$uniqueName = $folder[0];
|
||||
$realFolder = $folder[1];
|
||||
|
||||
|
||||
if(empty($uniqueName)){
|
||||
$return_link = getKleejaFtpInstance()->getLink('') . $realFolder;
|
||||
}else {
|
||||
$return_link = getKleejaFtpLink($uniqueName, $realFolder);
|
||||
}
|
||||
|
||||
return compact('return_link');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
'down_go_page' => function($args)
|
||||
{
|
||||
if(defined('DISABLE_KLJ_FTP')){
|
||||
return;
|
||||
}
|
||||
|
||||
if(strpos($args['f'], 'ftp://') !== false)
|
||||
{
|
||||
define('MAKE_DOPHP_301_HEADER', true);
|
||||
|
||||
$afterFTP = explode('ftp://', $args['f'], 2);
|
||||
|
||||
$filename = $args['n'];
|
||||
$folder = explode(':', $afterFTP[1], 2);
|
||||
$uniqueName = $folder[0];
|
||||
$realFolder = ig('thmb') || ig('thmbf') ? $folder[1] . '/thumbs' : $folder[1];
|
||||
|
||||
$path_file = getKleejaFtpLink($uniqueName, $realFolder, $filename);
|
||||
|
||||
return compact('path_file');
|
||||
}
|
||||
},
|
||||
|
||||
'kleeja_unlink_func' => function($args)
|
||||
{
|
||||
if(defined('DISABLE_KLJ_FTP')){
|
||||
return;
|
||||
}
|
||||
|
||||
if(strpos($args['filePath'], 'ftp://') !== false)
|
||||
{
|
||||
$afterFTP = explode('ftp://', $args['filePath'], 2);
|
||||
|
||||
$path = explode(':', $afterFTP[1], 2);
|
||||
$uniqueName = $path[0];
|
||||
$filePath = $path[1];
|
||||
|
||||
|
||||
$ftpAccount = getKleejaFtpAccount($uniqueName);
|
||||
|
||||
getKleejaFtpAccountInstance($ftpAccount)->delete($filePath);
|
||||
// getKleejaFtpAccountInstance($ftpAccount)->close();
|
||||
$return = true;
|
||||
return compact('return');
|
||||
}
|
||||
},
|
||||
|
||||
'end_common' => function()
|
||||
{
|
||||
global $dbprefix, $SQL;
|
||||
if(!
|
||||
$SQL->num_rows(
|
||||
$SQL->query("SELECT active FROM {$dbprefix}kj_ftp_info WHERE active=1")
|
||||
)
|
||||
){
|
||||
define('DISABLE_KLJ_FTP', true);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
'stats_start_admin' => function($args)
|
||||
{
|
||||
$ADM_NOTIFICATIONS = $args['ADM_NOTIFICATIONS'];
|
||||
|
||||
if(defined('DISABLE_KLJ_FTP')) {
|
||||
global $lang, $olang;
|
||||
|
||||
$ADM_NOTIFICATIONS['kljFtpNoActive'] = array(
|
||||
'id' => 'kljFtpNoActive',
|
||||
'msg_type'=> 'info',
|
||||
'title'=> $lang['NOTE'] . ' (' . $olang['R_KJ_FTP_OPTIONS'] . ')',
|
||||
'msg'=> $olang['KJ_FTP_NO_ACTIVE_ACCOUNTS_NOTE']
|
||||
);
|
||||
|
||||
}else{
|
||||
unset($ADM_NOTIFICATIONS['htaccess_u'], $ADM_NOTIFICATIONS['htaccess_t'], $ADM_NOTIFICATIONS['no_thumbs']);
|
||||
}
|
||||
|
||||
return compact('ADM_NOTIFICATIONS');
|
||||
},
|
||||
|
||||
|
||||
//support video plugin
|
||||
'plugin:video_player:do_display' => function($args){
|
||||
|
||||
$folder = $args['file_info']['folder'];
|
||||
$filename = $args['file_info']['name'];
|
||||
|
||||
if(strpos($folder, 'ftp://') !== false)
|
||||
{
|
||||
$afterFTP = explode('ftp://', $folder, 2);
|
||||
|
||||
$path = explode(':', $afterFTP[1], 2);
|
||||
$uniqueName = $path[0];
|
||||
$realFolder = $path[1];
|
||||
|
||||
|
||||
$video_path = getKleejaFtpLink($uniqueName, $realFolder, $filename);
|
||||
|
||||
return compact('video_path');
|
||||
}
|
||||
},
|
||||
|
||||
//support pdf plugin
|
||||
'plugin:pdf_viewer:do_display' => function($args){
|
||||
|
||||
$folder = $args['file_info']['folder'];
|
||||
$filename = $args['file_info']['name'];
|
||||
|
||||
if(strpos($folder, 'ftp://') !== false)
|
||||
{
|
||||
$afterFTP = explode('ftp://', $folder, 2);
|
||||
|
||||
$path = explode(':', $afterFTP[1], 2);
|
||||
$uniqueName = $path[0];
|
||||
$realFolder = $path[1];
|
||||
|
||||
|
||||
$pdf_path = getKleejaFtpLink($uniqueName, $realFolder, $filename);
|
||||
|
||||
return compact('pdf_path');
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
if(!function_exists('getKleejaFtpInstance'))
|
||||
{
|
||||
/**
|
||||
* @return kleeja_ftp|null
|
||||
*/
|
||||
function getKleejaFtpInstance()
|
||||
{
|
||||
if (!class_exists('kleeja_ftp'))
|
||||
{
|
||||
require_once dirname(__FILE__) . '/ftp.php';
|
||||
}
|
||||
|
||||
/** @var kleeja_ftp $kljFtp */
|
||||
static $kljFtp = null;
|
||||
|
||||
if (is_null($kljFtp))
|
||||
{
|
||||
global $dbprefix, $SQL, $cache;
|
||||
|
||||
|
||||
##### ------ > cached random, solve inadequate mySQL RAND.
|
||||
if (!($ftp_accounts = $cache->get('klj_ftp::ftp_names')))
|
||||
{
|
||||
$query = array(
|
||||
'SELECT' => 'k.name',
|
||||
'FROM' => "`{$dbprefix}kj_ftp_info` k",
|
||||
'WHERE' => 'k.active = 1'
|
||||
);
|
||||
|
||||
$result = $SQL->build($query);
|
||||
|
||||
$ftp_accounts = array();
|
||||
|
||||
while($row=$SQL->fetch_array($result))
|
||||
{
|
||||
array_push($ftp_accounts, $row['name']);
|
||||
}
|
||||
|
||||
$SQL->freeresult($result);
|
||||
|
||||
$cache->save('klj_ftp::ftp_names', $ftp_accounts);
|
||||
}
|
||||
|
||||
|
||||
if (sizeof($ftp_accounts) == 0) {
|
||||
kleeja_show_error(102, 'NO FTP ACCOUNT FOUND!', __FILE__, __LINE__);
|
||||
return null;
|
||||
}
|
||||
|
||||
####
|
||||
|
||||
|
||||
//random
|
||||
shuffle($ftp_accounts);
|
||||
shuffle($ftp_accounts);
|
||||
shuffle($ftp_accounts);
|
||||
|
||||
$ftp_account = getKleejaFtpAccount($ftp_accounts[0]);
|
||||
|
||||
$kljFtp = new kleeja_ftp();
|
||||
|
||||
$connect = $kljFtp->open(
|
||||
$ftp_account['host'],
|
||||
$ftp_account['username'],
|
||||
$ftp_account['password'],
|
||||
$ftp_account['port'],
|
||||
$ftp_account['root'],
|
||||
$ftp_account['passive'] == 1,
|
||||
$ftp_account['ssl'] == 1,
|
||||
$ftp_account['timeout']
|
||||
);
|
||||
|
||||
if(!$connect){
|
||||
kleeja_show_error(102, 'FTP ACCOUNT CAN NOT CONNECT (' . $ftp_account['name'] . ')!', __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
|
||||
$kljFtp->setUniqueName($ftp_account['name']);
|
||||
$kljFtp->setLink($ftp_account['link']);
|
||||
|
||||
register_shutdown_function(function() { getKleejaFtpInstance()->close(); } );
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $kljFtp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!function_exists('getKleejaFtpAccountInstance'))
|
||||
{
|
||||
/**
|
||||
* @return kleeja_ftp|null
|
||||
*/
|
||||
function getKleejaFtpAccountInstance($ftp_account)
|
||||
{
|
||||
if (!class_exists('kleeja_ftp'))
|
||||
{
|
||||
require_once dirname(__FILE__) . '/ftp.php';
|
||||
}
|
||||
|
||||
|
||||
/** @var kleeja_ftp $kljFtp */
|
||||
static $kljFtp = null;
|
||||
//
|
||||
if ($kljFtp === null || $kljFtp->getUniqueName() !== $ftp_account['name'])
|
||||
{
|
||||
|
||||
$kljFtp = new kleeja_ftp();
|
||||
|
||||
$connect = $kljFtp->open(
|
||||
$ftp_account['host'],
|
||||
$ftp_account['username'],
|
||||
$ftp_account['password'],
|
||||
$ftp_account['port'],
|
||||
$ftp_account['root'],
|
||||
$ftp_account['passive'] == 1,
|
||||
$ftp_account['ssl'] == 1,
|
||||
$ftp_account['timeout']
|
||||
);
|
||||
|
||||
if(!$connect){
|
||||
kleeja_show_error(102, 'FTP ACCOUNT CAN NOT CONNECT (' . $ftp_account['name'] . ')!', __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
|
||||
$kljFtp->setUniqueName($ftp_account['name']);
|
||||
$kljFtp->setLink($ftp_account['link']);
|
||||
|
||||
|
||||
register_shutdown_function(function() use($kljFtp) { $kljFtp->close(); } );
|
||||
}
|
||||
|
||||
|
||||
return $kljFtp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!function_exists('getKleejaFtpAccount'))
|
||||
{
|
||||
function getKleejaFtpAccount($uniqueName)
|
||||
{
|
||||
global $dbprefix, $SQL;
|
||||
|
||||
$query = array(
|
||||
'SELECT' => 'k.*',
|
||||
'FROM' => "`{$dbprefix}kj_ftp_info` k",
|
||||
'WHERE' => "k.name = '" . $SQL->escape($uniqueName) . "'",
|
||||
'LIMIT' => '1'
|
||||
);
|
||||
|
||||
$result = $SQL->build($query);
|
||||
|
||||
if($SQL->num_rows($result))
|
||||
{
|
||||
return $SQL->fetch_array($result);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('getKleejaFtpLink'))
|
||||
{
|
||||
function getKleejaFtpLink($uniqueName, $folder, $filename = '')
|
||||
{
|
||||
$ftp_account = getKleejaFtpAccount($uniqueName);
|
||||
if($ftp_account == false)
|
||||
{
|
||||
return '...' . $uniqueName . '...';
|
||||
}
|
||||
|
||||
|
||||
$link = !empty($ftp_account['link']) ? trim($ftp_account['link']) : '';
|
||||
$host = trim($ftp_account['host']);
|
||||
$rootPath = trim($ftp_account['root']);
|
||||
|
||||
if($link != '')
|
||||
{
|
||||
return ltrim($link, '/') . '/' . $folder . ($filename !== '' ? '/' . $filename : '');
|
||||
}
|
||||
|
||||
|
||||
if ($rootPath != '')
|
||||
{
|
||||
if (substr($rootPath, -1, 1) == '/')
|
||||
{
|
||||
$rootPath = substr($rootPath, 0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
return $host . '/' . $rootPath . '/' . $folder . ($filename !== '' ? '/' . $filename : '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
<?php
|
||||
|
||||
// not for directly open
|
||||
if (!defined('IN_ADMIN'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (intval($userinfo['founder']) !== 1) {
|
||||
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS'], ADMIN_PATH.'?cp='.basename(__FILE__, '.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
#current case
|
||||
$current_case = g('case');
|
||||
|
||||
#current template
|
||||
$stylee = 'admin_kjftp';
|
||||
|
||||
#template folder path
|
||||
$styleePath = dirname(__FILE__);
|
||||
|
||||
|
||||
$action = basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php');
|
||||
|
||||
$H_FORM_KEYS = kleeja_add_form_key('adm_kj_ftp');
|
||||
|
||||
|
||||
if(ip('submit'))
|
||||
{
|
||||
$current_case = p('type') == 'new' ? 'new' : 'edit';
|
||||
|
||||
if(!kleeja_check_form_key('adm_kj_ftp', 3600))
|
||||
{
|
||||
kleeja_admin_err($lang['INVALID_FORM_KEY'], true, $lang['ERROR'], true, $action, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ERRORS = false;
|
||||
|
||||
switch ($current_case)
|
||||
{
|
||||
/**
|
||||
* show a list of current ftp accounts
|
||||
*/
|
||||
default:
|
||||
case 'list':
|
||||
|
||||
#TODO show a error if no active account exists
|
||||
//There is no active FTP account! activate an account or disable this plugin to use standard local files uploading system.
|
||||
|
||||
$query = array(
|
||||
'SELECT' => 'k.*',
|
||||
'FROM' => "`{$dbprefix}kj_ftp_info` k",
|
||||
'ORDER BY' => 'k.id ASC'
|
||||
);
|
||||
|
||||
|
||||
$result = $SQL->build($query);
|
||||
|
||||
$result_number = $SQL->num_rows($result);
|
||||
|
||||
$ftp_accounts = array();
|
||||
|
||||
if($result_number > 0)
|
||||
{
|
||||
while($row=$SQL->fetch_array($result))
|
||||
{
|
||||
unset($row['password']);
|
||||
|
||||
$ftp_accounts[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$SQL->free();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
/**
|
||||
* no need!
|
||||
*/
|
||||
case 'delete':
|
||||
break;
|
||||
|
||||
|
||||
/**
|
||||
* add new ftp account
|
||||
*/
|
||||
case 'new':
|
||||
|
||||
|
||||
//is this enough ?
|
||||
$unique_name = uniqid();
|
||||
|
||||
|
||||
$insert_query = array(
|
||||
'INSERT' => 'name, host',
|
||||
'INTO' => "{$dbprefix}kj_ftp_info",
|
||||
'VALUES' => "'$unique_name', 'example.com'"
|
||||
);
|
||||
|
||||
if ($SQL->build($insert_query)) {
|
||||
$last_user_id = $SQL->insert_id();
|
||||
|
||||
kleeja_admin_info($olang['KJ_FTP_ACCOUNT_ADDED'], true, '', true, $action, 3);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'edit':
|
||||
|
||||
#save, show info
|
||||
$data = array(
|
||||
'name' => p('name'),
|
||||
'host' => p('host'),
|
||||
'username' => p('username'),
|
||||
'password' => p('password'),
|
||||
'link' => p('link'),
|
||||
'port' => p('port', 'int'),
|
||||
'root' => p('root'),
|
||||
'passive' => ip('passive') ? 1 : 0,
|
||||
'active' => ip('active') ? 1 : 0,
|
||||
'ssl' => ip('ssl') ? 1 : 0,
|
||||
);
|
||||
|
||||
|
||||
if($data['port'] == 0){
|
||||
$data['port'] = 21;
|
||||
}
|
||||
|
||||
if(strpos($data['host'], 'ftp://') !== false){
|
||||
$data['host'] = str_replace('ftp://', '', $data['host']);
|
||||
}
|
||||
|
||||
if(strpos($data['host'], 'http://') !== false){
|
||||
$data['host'] = str_replace('http://', '', $data['host']);
|
||||
}
|
||||
|
||||
if(strpos($data['host'], 'https://') !== false){
|
||||
$data['host'] = str_replace('https://', '', $data['host']);
|
||||
}
|
||||
|
||||
if ($data['password'] === '') {
|
||||
unset($data['password']);
|
||||
}
|
||||
|
||||
|
||||
if(
|
||||
$SQL->num_rows(
|
||||
$SQL->query("SELECT * FROM {$dbprefix}kj_ftp_info WHERE id<>" . p('id') . " AND name='" . $SQL->escape($data['name']) . "'")
|
||||
)
|
||||
)
|
||||
{
|
||||
kleeja_admin_err($olang['KJ_FTP_ACCOUNT_NAME_CONFLICT'], true, '', true, $action);
|
||||
}
|
||||
|
||||
|
||||
$updateSet = '';
|
||||
foreach ($data as $n=>$v){
|
||||
$updateSet .= ($updateSet == '' ? '' : ', '). "`$n`='" . $SQL->escape($v) . "'";
|
||||
}
|
||||
|
||||
$update_query = array(
|
||||
'UPDATE' => "{$dbprefix}kj_ftp_info",
|
||||
'SET' => $updateSet,
|
||||
'WHERE' => "id=". p('id')
|
||||
);
|
||||
|
||||
$SQL->build($update_query);
|
||||
|
||||
|
||||
$cache->clean('klj_ftp::ftp_names');
|
||||
|
||||
kleeja_admin_info($olang['KJ_FTP_ACCOUNT_UPDATED'], true, '', true, $action, 2);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 99 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,283 +0,0 @@
|
||||
<?php
|
||||
# kleeja plugin
|
||||
# kj_meta_seo
|
||||
# version: 1.0
|
||||
# developer: kleeja team
|
||||
|
||||
# prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# plugin basic information
|
||||
$kleeja_plugin['kj_meta_seo']['information'] = array(
|
||||
# the casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'KJ Meta SEO',
|
||||
'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' => 'Meta fields plugin to enhance SEO for Kleeja',
|
||||
'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.9',
|
||||
# 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_meta_seo']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك إضافة الميتا لكليجا، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
$kleeja_plugin['kj_meta_seo']['first_run']['en'] = "
|
||||
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_meta_seo']['install'] = function ($plg_id) {
|
||||
//new options
|
||||
$options = array(
|
||||
'kj_meta_seo_home_meta_description' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('kj_meta_seo_home_meta_description'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_meta_seo',
|
||||
'order' => '1',
|
||||
),
|
||||
'kj_meta_seo_home_meta_keywords' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('kj_meta_seo_home_meta_keywords'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_meta_seo',
|
||||
'order' => '2',
|
||||
),
|
||||
'kj_meta_seo_enable_auto_meta' =>
|
||||
array(
|
||||
'value' => '1',
|
||||
'html' => configField('kj_meta_seo_enable_auto_meta', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_meta_seo',
|
||||
'order' => '3',
|
||||
),
|
||||
'kj_meta_seo_enable_download_auto_meta' =>
|
||||
array(
|
||||
'value' => '1',
|
||||
'html' => configField('kj_meta_seo_enable_download_auto_meta', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_meta_seo',
|
||||
'order' => '4',
|
||||
),
|
||||
'kj_meta_seo_enable_facebook_meta_tags' =>
|
||||
array(
|
||||
'value' => '1',
|
||||
'html' => configField('kj_meta_seo_enable_facebook_meta_tags', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_meta_seo',
|
||||
'order' => '5',
|
||||
),
|
||||
'kj_meta_seo_enable_twitter_meta_tags' =>
|
||||
array(
|
||||
'value' => '1',
|
||||
'html' => configField('kj_meta_seo_enable_twitter_meta_tags', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_meta_seo',
|
||||
'order' => '6',
|
||||
),
|
||||
'kj_meta_seo_image_path' =>
|
||||
array(
|
||||
'value' => 'iPhone.png',
|
||||
'html' => configField('kj_meta_seo_image_path'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_meta_seo',
|
||||
'order' => '7',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'CONFIG_KLJ_MENUS_KJ_META_SEO' => 'خيارات ميتا سيو',
|
||||
'KJ_META_SEO_HOME_META_DESCRIPTION' => 'الميتا دسكربشن/الوصف للبداية',
|
||||
'KJ_META_SEO_HOME_META_KEYWORDS' => 'الميتا كيووردز/الكلمات للبداية',
|
||||
'KJ_META_SEO_ENABLE_AUTO_META' => 'إنشاء الميتا بشكل تلقائي لباقي الصفحات',
|
||||
'KJ_META_SEO_ENABLE_DOWNLOAD_AUTO_META' => 'إنشاء الميتا بشكل تلقائي لصفحة التحميل',
|
||||
'KJ_META_SEO_ENABLE_FACEBOOK_META_TAGS' => 'تضمين الميتا أوبن قراف الخاصة بفيس بوك',
|
||||
'KJ_META_SEO_ENABLE_TWITTER_META_TAGS' => 'تضمين الميتا كاردز الخاصة بتويتر',
|
||||
'KJ_META_SEO_IMAGE_PATH' => 'الصورة المضمنة في الميتا (توضع في مجلد images)',
|
||||
|
||||
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'CONFIG_KLJ_MENUS_KJ_META_SEO' => 'Meta SEO Settings',
|
||||
'KJ_META_SEO_HOME_META_DESCRIPTION' => 'Meta description',
|
||||
'KJ_META_SEO_HOME_META_KEYWORDS' => 'Meta keywords',
|
||||
'KJ_META_SEO_ENABLE_AUTO_META' => 'Auto generate meta codes for all pages',
|
||||
'KJ_META_SEO_ENABLE_DOWNLOAD_AUTO_META' => 'Auto generate meta codes for download page',
|
||||
'KJ_META_SEO_ENABLE_FACEBOOK_META_TAGS' => 'Includes Facebook OpenGraph meta tags',
|
||||
'KJ_META_SEO_ENABLE_TWITTER_META_TAGS' => 'Includes Twitter Cards meta tags',
|
||||
'KJ_META_SEO_IMAGE_PATH' => 'Included image in meta (from folder: images)',
|
||||
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['kj_meta_seo']['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_meta_seo']['uninstall'] = function ($plg_id) {
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'kj_meta_seo_home_meta_description',
|
||||
'kj_meta_seo_home_meta_keywords',
|
||||
'kj_meta_seo_enable_auto_meta',
|
||||
'kj_meta_seo_enable_download_auto_meta',
|
||||
'kj_meta_seo_enable_facebook_meta_tags',
|
||||
'kj_meta_seo_enable_twitter_meta_tags',
|
||||
'kj_meta_seo_image_path',
|
||||
));
|
||||
|
||||
|
||||
//delete language variables
|
||||
foreach (['ar', 'en'] as $language) {
|
||||
delete_olang(null, $language, $plg_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# plugin functions
|
||||
$kleeja_plugin['kj_meta_seo']['functions'] = array(
|
||||
'Saaheader_links_func' => function ($args) {
|
||||
$extra = $args['extra'] . kj_meta_seo_out(
|
||||
defined('IN_DOWNLOAD') ? 'download' : (defined('IN_REAL_INDEX') ? 'home' : 'any')
|
||||
);
|
||||
return compact('extra');
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* special functions
|
||||
*/
|
||||
if (!function_exists('kj_meta_seo_out')) {
|
||||
function kj_meta_seo_out($in = '')
|
||||
{
|
||||
global $config, $title;
|
||||
|
||||
|
||||
if($in == 'download' && $config['kj_meta_seo_enable_download_auto_meta'] == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
if($in == 'any' && $config['kj_meta_seo_enable_auto_meta'] == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$metas = [];
|
||||
|
||||
$desc = '';
|
||||
$keywords = '';
|
||||
|
||||
$included_image = rtrim($config['siteurl'], '/') . '/images/' . $config['kj_meta_seo_image_path'];
|
||||
|
||||
switch ($in){
|
||||
case 'home':
|
||||
|
||||
$desc = $config['kj_meta_seo_home_meta_description'];
|
||||
$keywords = str_replace("،", ",", $config['kj_meta_seo_home_meta_keywords']);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
$desc = $title;
|
||||
$keywords = implode(', ', kj_meta_seo_keywords_extract($title));
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$metas = array_merge($metas, array(
|
||||
'<meta name="description" content="' . $desc . '">',
|
||||
'<meta name="keywords" content="' . $keywords . '" >'
|
||||
));
|
||||
|
||||
|
||||
|
||||
$actual_link = htmlspecialchars('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
||||
|
||||
|
||||
if($config['kj_meta_seo_enable_facebook_meta_tags'] == 1) {
|
||||
$facebook_meta = array(
|
||||
'<meta property="og:type" content="website">',
|
||||
'<meta property="og:title" content="' . $title . '">',
|
||||
'<meta property="og:image" content="' . $included_image . '">',
|
||||
'<meta property="og:url" content="' . $actual_link . '">',
|
||||
'<meta property="og:site_name" content="' . $config['sitename'] . '">',
|
||||
'<meta property="og:description" content="' . htmlspecialchars($desc) . '">'
|
||||
);
|
||||
|
||||
$metas = array_merge($metas, $facebook_meta);
|
||||
}
|
||||
|
||||
if($config['kj_meta_seo_enable_twitter_meta_tags'] == 1) {
|
||||
$twitter_meta = array(
|
||||
'<meta name="twitter:card" content="summary">',
|
||||
'<meta name="twitter:title" content="'. $title .'">',
|
||||
'<meta name="twitter:description" content="' . htmlspecialchars($desc) . '">',
|
||||
'<meta name="twitter:image" content="' . $included_image . '">',
|
||||
);
|
||||
|
||||
$metas = array_merge($metas, $twitter_meta);
|
||||
}
|
||||
|
||||
return '
|
||||
<!-- kj_meta_seo start -->
|
||||
' . implode("\n ", $metas) . '
|
||||
<!-- kj_meta_seo end -->
|
||||
';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('kj_meta_seo_keywords_extract')) {
|
||||
function kj_meta_seo_keywords_extract($string = '')
|
||||
{
|
||||
return array_filter(preg_split("!\W!", $string));
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 93 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,469 +0,0 @@
|
||||
<?php
|
||||
# kleeja plugin
|
||||
# kj_recaptcha
|
||||
# version: 1.3
|
||||
# developer: kleeja team
|
||||
|
||||
|
||||
# prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# plugin basic information
|
||||
$kleeja_plugin['kj_recaptcha']['information'] = array(
|
||||
# the casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'KJ reCaptcha',
|
||||
'ar' => 'كليجا ريكابتشا'
|
||||
),
|
||||
# who wrote this plugin?
|
||||
'plugin_developer' => 'kleeja.com',
|
||||
# this plugin version
|
||||
'plugin_version' => '1.3',
|
||||
# explain what is this plugin, why should i use it?
|
||||
'plugin_description' => array(
|
||||
'en' => 'Add reCaptcha to Kleeja',
|
||||
'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.9',
|
||||
# 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_recaptcha']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك إضافة الريكابتشا لكليجا، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
<br>
|
||||
للحصول على مفتاح وكود ريكابتشا السري سجل في موقعهم:
|
||||
<a href='https://www.google.com/recaptcha'>google.com/reCaptcha</a>.
|
||||
<br>
|
||||
ثم أضفها في إعدادات -> خيارات الريكابتشا
|
||||
";
|
||||
|
||||
$kleeja_plugin['kj_recaptcha']['first_run']['en'] = "
|
||||
Thank you for using our plugin, if you encounter any bugs and errors, contact us: <br>
|
||||
info@kleeja.com
|
||||
<br>
|
||||
to get the reCaptcha sitekey and secret code, visit:
|
||||
<a href='https://www.google.com/recaptcha'>google.com/reCaptcha</a>.
|
||||
<br>
|
||||
then configure this plugin from: settings -> reCaptcha settings
|
||||
";
|
||||
|
||||
# plugin installation function
|
||||
$kleeja_plugin['kj_recaptcha']['install'] = function ($plg_id) {
|
||||
//new options
|
||||
$options = array(
|
||||
'kj_recaptcha_sitekey' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('kj_recaptcha_sitekey'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_recaptcha'
|
||||
),
|
||||
'kj_recaptcha_secret' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('kj_recaptcha_secret'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_recaptcha'
|
||||
),
|
||||
'kj_recaptcha_invisible' =>
|
||||
array(
|
||||
'value' => '0',
|
||||
'html' => configField('kj_recaptcha_invisible', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_recaptcha'
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'KJ_RECAPTCHA_SITEKEY' => 'مفتاح الرياكبتشا | sitekey',
|
||||
'KJ_RECAPTCHA_SECRET' => 'الكود السري للريكابتشا | secret',
|
||||
'KJ_RECAPTCHA_INVISIBLE' => 'نوع الريكابتشا: مخفية invisible',
|
||||
'CONFIG_KLJ_MENUS_KJ_RECAPTCHA' => 'خيارات ريكابتشا',
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'KJ_RECAPTCHA_SITEKEY' => 'reCaptcha sitekey',
|
||||
'KJ_RECAPTCHA_SECRET' => 'reCaptcha secret',
|
||||
'KJ_RECAPTCHA_INVISIBLE' => 'reCaptcha Type: Invisible',
|
||||
'CONFIG_KLJ_MENUS_KJ_RECAPTCHA' => 'reCaptcha Settings',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['kj_recaptcha']['update'] = function ($old_version, $new_version) {
|
||||
|
||||
$plg_id = Plugins::getInstance()->installed_plugin_info('kj_recaptcha');
|
||||
|
||||
if(version_compare($old_version, '1.3', '<')){
|
||||
$options = array(
|
||||
'kj_recaptcha_invisible' =>
|
||||
array(
|
||||
'value' => '0',
|
||||
'html' => configField('kj_recaptcha_invisible', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_recaptcha'
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'KJ_RECAPTCHA_INVISIBLE' => 'نوع الريكابتشا: مخفية invisible',
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'KJ_RECAPTCHA_INVISIBLE' => 'reCaptcha Type: Invisible',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 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_recaptcha']['uninstall'] = function ($plg_id) {
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'kj_recaptcha_sitekey',
|
||||
'kj_recaptcha_secret',
|
||||
'kj_recaptcha_invisible'
|
||||
));
|
||||
|
||||
|
||||
foreach (array('ar', 'en') as $language) {
|
||||
delete_olang(null, $language, $plg_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# plugin functions
|
||||
$kleeja_plugin['kj_recaptcha']['functions'] = array(
|
||||
'Saaheader_links_func' => function ($args) {
|
||||
global $config;
|
||||
$extra = $args['extra'] . "\n" . getReCaptchaInputHeadHtml();
|
||||
return compact('extra');
|
||||
},
|
||||
|
||||
'before_display_template_admin_page' => function ($args) {
|
||||
global $config;
|
||||
$extra_header_admin_login = $args['extra_header_admin_login'] . "\n" . getReCaptchaInputHeadHtml();
|
||||
$show_captcha = false;
|
||||
return compact('extra_header_admin_login', 'show_captcha');
|
||||
},
|
||||
|
||||
'style_parse_func' => function($args) {
|
||||
global $config;
|
||||
|
||||
|
||||
if(in_array($args['template_name'], array('call', 'report', 'register', 'login')) && defined('reCaptcha_all')){
|
||||
$html = preg_replace(
|
||||
'/(<IF\s{1,}NAME="config.enable_captcha==1">)/',
|
||||
getReCaptchaInputHtml().'$1',
|
||||
$args['html']);
|
||||
|
||||
return compact('html');
|
||||
}else if($args['template_name'] == 'index_body' && defined('reCaptcha_index')){
|
||||
$html = preg_replace(
|
||||
'/(<IF\s{1,}NAME="config.safe_code">)/',
|
||||
getReCaptchaInputHtml().'$1',
|
||||
$args['html']);
|
||||
return compact('html');
|
||||
}else if($args['template_name'] == 'admin_login'){
|
||||
|
||||
$html = preg_replace(
|
||||
'/(<IF\s{1,}NAME="show_captcha">)/',
|
||||
getReCaptchaInputHtml().'$1',
|
||||
$args['html']);
|
||||
|
||||
unset($_SESSION['SHOW_CAPTCHA']);
|
||||
return compact('html');
|
||||
}
|
||||
},
|
||||
|
||||
'admin_login_submit' => function($args){
|
||||
global $lang;
|
||||
|
||||
if(!isReCaptchaValid()) {
|
||||
$ERRORS = $args['ERRORS'];
|
||||
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
|
||||
return compact('ERRORS');
|
||||
}
|
||||
},
|
||||
|
||||
'end_common' => function($args){
|
||||
global $config;
|
||||
if($config['safe_code'] == 1){
|
||||
define('reCaptcha_index', true);
|
||||
}
|
||||
|
||||
if($config['enable_captcha'] == 1){
|
||||
define('reCaptcha_all', true);
|
||||
}
|
||||
|
||||
$config['enable_captcha'] = 0;
|
||||
$config['safe_code'] = 0;
|
||||
},
|
||||
|
||||
'submit_report_go_page' => function ($args){
|
||||
global $lang;
|
||||
|
||||
if(!isReCaptchaValid()) {
|
||||
$ERRORS = $args['ERRORS'];
|
||||
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
|
||||
return compact('ERRORS');
|
||||
}
|
||||
},
|
||||
|
||||
'register_submit' => function ($args){
|
||||
global $lang;
|
||||
|
||||
if(!isReCaptchaValid()) {
|
||||
$ERRORS = $args['ERRORS'];
|
||||
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
|
||||
return compact('ERRORS');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
'login_after_submit' => function ($args){
|
||||
global $lang;
|
||||
|
||||
if(!isReCaptchaValid()) {
|
||||
$ERRORS = $args['ERRORS'];
|
||||
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
|
||||
return compact('ERRORS');
|
||||
}
|
||||
},
|
||||
|
||||
'submit_call_go_page' => function($args){
|
||||
global $lang;
|
||||
|
||||
if(!isReCaptchaValid()) {
|
||||
$ERRORS = $args['ERRORS'];
|
||||
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
|
||||
return compact('ERRORS');
|
||||
}
|
||||
},
|
||||
|
||||
'defaultUploader_upload_1st' => function($args){
|
||||
global $lang;
|
||||
|
||||
if(!defined('reCaptcha_index')){
|
||||
return null;
|
||||
}
|
||||
|
||||
$captcha_enabled = true;
|
||||
|
||||
return compact('captcha_enabled');
|
||||
|
||||
},
|
||||
|
||||
|
||||
'kleeja_check_captcha_func' => function($args){
|
||||
|
||||
if(defined('IN_REAL_INDEX')){
|
||||
$return = isReCaptchaValid();
|
||||
return compact('return');
|
||||
}
|
||||
|
||||
// if(defined('IN_ADMIN')) {
|
||||
$return = true;
|
||||
return compact('return');
|
||||
// }
|
||||
},
|
||||
|
||||
'ftpUploader_upload_1st' => function($args){
|
||||
global $lang;
|
||||
|
||||
if(!defined('reCaptcha_index')){
|
||||
return null;
|
||||
}
|
||||
|
||||
$captcha_enabled = true;
|
||||
|
||||
return compact('captcha_enabled');
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* special functions
|
||||
*/
|
||||
|
||||
if(! function_exists('getReCaptchaInputHtml'))
|
||||
{
|
||||
function getReCaptchaInputHtml()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if($config['kj_recaptcha_invisible'] == 1)
|
||||
{
|
||||
return '<div id="aarecaptcha" style="margin: 10px 0; text-align: center; max-width: 255px;"></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<div class="g-recaptcha" data-sitekey="' . $config['kj_recaptcha_sitekey'] . '" style="margin: 10px 0; text-align: center; max-width: 255px;"></div>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(! function_exists('getReCaptchaInputHeadHtml'))
|
||||
{
|
||||
function getReCaptchaInputHeadHtml()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if($config['kj_recaptcha_invisible'] == 1)
|
||||
{
|
||||
return '<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=' . $config['language'] . '"></script>'.
|
||||
'<script>
|
||||
|
||||
var disableSubmit = function(state){
|
||||
|
||||
var children = document.getElementsByTagName("form").childNodes;
|
||||
|
||||
var parent = null;
|
||||
|
||||
for(child in children){
|
||||
if (children.hasOwnProperty(child)) {
|
||||
if(child.getElementById("aarecaptcha") !== null){
|
||||
parent = child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(parent === null){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
parent.querySelectorAll("input[type=submit]").disabled = state;
|
||||
|
||||
};
|
||||
|
||||
var onloadCallback = function(){
|
||||
|
||||
disableSubmit(true);
|
||||
|
||||
grecaptcha.render("aarecaptcha", {
|
||||
"sitekey" : "'.$config['kj_recaptcha_sitekey'].'",
|
||||
"badge" : "inline",
|
||||
"size" : "invisible",
|
||||
"callback" : function(token){
|
||||
disableSubmit(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
grecaptcha.execute();
|
||||
};
|
||||
|
||||
|
||||
|
||||
</script>';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<script src="https://www.google.com/recaptcha/api.js?hl=' . $config['language'] . '"></script>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('isReCaptchaValid')) {
|
||||
function isReCaptchaValid()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if(empty($config['kj_recaptcha_sitekey']) || empty($config['kj_recaptcha_secret'])){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ip('g-recaptcha-response') || empty(p('g-recaptcha-response'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
$data = array(
|
||||
'secret' => $config['kj_recaptcha_secret'],
|
||||
'response' => p('g-recaptcha-response'),
|
||||
'remoteip' => $_SERVER['REMOTE_ADDR']
|
||||
);
|
||||
|
||||
|
||||
$url = 'https://www.google.com/recaptcha/api/siteverify?' . http_build_query($data);
|
||||
|
||||
$result = fetch_remote_file($url);
|
||||
//
|
||||
// if (function_exists('curl_version')) {
|
||||
// $curl = curl_init($url . "?" . http_build_query($data));
|
||||
// curl_setopt($curl, CURLOPT_HEADER, false);
|
||||
// curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
// curl_setopt($curl, CURLOPT_TIMEOUT, 1);
|
||||
// curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
// $result = curl_exec($curl);
|
||||
//
|
||||
// } else {
|
||||
//// $options = array(
|
||||
//// 'http' => array(
|
||||
//// 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
//// 'method' => 'POST',
|
||||
//// 'content' => http_build_query($data)
|
||||
//// )
|
||||
//// );
|
||||
////
|
||||
//// $context = stream_context_create($options);
|
||||
////
|
||||
//// //TODO use our function for fallback
|
||||
// $result = file_get_contents($url, false, $context);
|
||||
// }
|
||||
|
||||
|
||||
if (empty($result) || is_null($result)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) json_decode($result)->success;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 93 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,285 +0,0 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# kj_sitemap_seo
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['kj_sitemap_seo']['information'] = array(
|
||||
# The casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array('en' => 'KJ SiteMap SEO', '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' => 'Generate a sitemap and promote your content by notifying (ping) the search engine once at every new content addition to Kleeja',
|
||||
'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' => '4.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_sitemap_seo']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك إضافة السايت ماب لكليجا، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
<hr>
|
||||
<br>
|
||||
<h3>لاحظ:</h3>
|
||||
لأداء أفضل للسايت ماب، قم بإضافة السطر التالي لملف : robots.txt <br>
|
||||
هذا الملف يكون في مجلد كليجا الأساسي وإن لم يكن موجود فقم بإضافته ثم إضافة السطر التالي له:
|
||||
<br>
|
||||
<br>
|
||||
<b>Sitemap:</b> " . (!empty($config['siteurl']) ? $config['siteurl'] : 'http://example.com/') . "go.php?go=sitemap
|
||||
<br> أو:
|
||||
<br>
|
||||
" . (!empty($config['siteurl']) ? $config['siteurl'] : 'http://example.com/') . "sitemap.xml
|
||||
|
||||
<hr>
|
||||
<br>
|
||||
<b>تجد إعدادات الإضافة في : إعدادات المركز->خيارات سايب ماب سيو</b>
|
||||
";
|
||||
|
||||
$kleeja_plugin['kj_sitemap_seo']['first_run']['en'] = "
|
||||
Thank you for using our plugin, if you encounter any bugs and errors, contact us: <br>
|
||||
info@kleeja.com
|
||||
<hr>
|
||||
<br>
|
||||
<h3>Note:</h3>
|
||||
For better results, a file named 'robots.txt' should be existed at Kleeja root folder (same folder as config.php file), and has this line: <br>
|
||||
<b>Sitemap:</b> <br> " . (!empty($config['siteurl']) ? $config['siteurl'] : 'http://example.com/') . "go.php?go=sitemap
|
||||
<br> or:
|
||||
<br>
|
||||
" . (!empty($config['siteurl']) ? $config['siteurl'] : 'http://example.com/') . "sitemap.xml
|
||||
<hr>
|
||||
<br>
|
||||
<b>For Plugin's settings: General Settings->SiteMap SEO Settings</b>
|
||||
";
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['kj_sitemap_seo']['install'] = function ($plg_id) {
|
||||
//new options
|
||||
$options = array(
|
||||
'kj_sitemap_seo_sitemap_ping_enable' =>
|
||||
array(
|
||||
'value' => '0',
|
||||
'html' => configField('kj_sitemap_seo_sitemap_ping_enable', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_sitemap_seo'
|
||||
),
|
||||
'kj_sitemap_seo_sitemap_ping_time' =>
|
||||
array(
|
||||
'value' => '0',
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_sitemap_seo'
|
||||
),
|
||||
);
|
||||
|
||||
//TODO add an option to let the use decide the interval between pings
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'KJ_SITEMAP_SEO_SITEMAP_PING_ENABLE' => 'تفعيل إعلام محركات البحث عن المحتوى الجديد',
|
||||
'CONFIG_KLJ_MENUS_KJ_SITEMAP_SEO' => 'خيارات سايب ماب سيو',
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'KJ_SITEMAP_SEO_SITEMAP_PING_ENABLE' => 'Notify (ping) search engine about new content',
|
||||
'CONFIG_KLJ_MENUS_KJ_SITEMAP_SEO' => 'SiteMap SEO Settings',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
|
||||
|
||||
|
||||
if(function_exists('add_to_serve_rules')){
|
||||
add_to_serve_rules("'^sitemap\.xml$' => ['file' => 'go.php', 'args' => 'go=sitemap'],", 'kj_sitemap_seo');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//Plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['kj_sitemap_seo']['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 Uninstall, function to be called at uninstalling
|
||||
$kleeja_plugin['kj_sitemap_seo']['uninstall'] = function ($plg_id) {
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'kj_sitemap_seo_sitemap_ping_enable',
|
||||
'kj_sitemap_seo_sitemap_ping_time'
|
||||
));
|
||||
|
||||
|
||||
//delete language variables
|
||||
delete_olang(null, null, $plg_id);
|
||||
|
||||
|
||||
//remove rules
|
||||
if(function_exists('remove_from_serve_rules')) {
|
||||
remove_from_serve_rules('kj_sitemap_seo');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['kj_sitemap_seo']['functions'] = array(
|
||||
|
||||
|
||||
//new page
|
||||
'default_go_page' => function () {
|
||||
global $SQL, $dbprefix, $config;
|
||||
|
||||
if (g('go') == 'sitemap') {
|
||||
header('Content-Type: application/xml; charset=utf-8');
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
||||
echo '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
||||
|
||||
$query = array(
|
||||
'SELECT' => 'f.id, f.name, f.real_filename, f.folder, f.type, f.time',
|
||||
'FROM' => "{$dbprefix}files f",
|
||||
'ORDER BY' => 'f.id DESC',
|
||||
'LIMIT' => '100'
|
||||
);
|
||||
|
||||
$result = $SQL->build($query);
|
||||
|
||||
|
||||
while ($file = $SQL->fetch($result)) {
|
||||
$file_info = array('::ID::' => $file['id'], '::NAME::' => $file['name'], '::DIR::' => $file['folder'], '::FNAME::' => $file['real_filename']);
|
||||
|
||||
echo '<url>' . "\n";
|
||||
echo " " . '<loc>' . kleeja_get_link(is_image($file['type']) ? 'image' : 'file', $file_info) . '</loc>' . "\n";
|
||||
if (is_image($file['type'])) {
|
||||
|
||||
echo " " . '<image:image><image:loc>' . kleeja_get_link('thumb', $file_info) . '</image:loc><image:caption>' . (trim($file['real_filename']) !== '' ? xml_entities(htmlspecialchars($file['real_filename'])) : xml_entities(htmlspecialchars($file['name']))) . '</image:caption></image:image>' . "\n";
|
||||
}
|
||||
echo " " . '<lastmod>' . date('c', $file['time']) . '</lastmod>' . "\n";
|
||||
echo '</url>' . "\n";
|
||||
}
|
||||
echo '</urlset>';
|
||||
|
||||
$SQL->free($result);
|
||||
|
||||
#at end, close sql connections & etc
|
||||
$SQL->close();
|
||||
|
||||
// #tell kleeja that we have a request from go=sitemap
|
||||
// $no_request = false;
|
||||
exit;
|
||||
}
|
||||
},
|
||||
|
||||
//output in header
|
||||
'Saaheader_links_func' => function ($args) {
|
||||
global $config;
|
||||
$extra = $args['extra'] . "\n" .
|
||||
'<link rel="sitemap" type="application/xml" title="Sitemap" href="' . rtrim($config['siteurl'], '/') . '/go.php?go=sitemap">';
|
||||
return compact('extra');
|
||||
},
|
||||
|
||||
//ping after uploading files?
|
||||
'kljuploader_process_after_loop' => function ($args) {
|
||||
if (isset($args['check'])) {
|
||||
send_a_ping();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* special functions
|
||||
*/
|
||||
|
||||
if (!function_exists('xml_entities')) {
|
||||
function xml_entities($string)
|
||||
{
|
||||
return strtr(
|
||||
$string,
|
||||
array(
|
||||
"<" => "<",
|
||||
">" => ">",
|
||||
'"' => """,
|
||||
"'" => "'",
|
||||
"&" => "&",
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('is_image')) {
|
||||
function is_image($pre_ext)
|
||||
{
|
||||
return in_array(strtolower(trim($pre_ext)), array('gif', 'jpg', 'jpeg', 'bmp', 'png')) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('send_a_ping')) {
|
||||
function send_a_ping()
|
||||
{
|
||||
global $config;
|
||||
|
||||
//dev ?
|
||||
// if(defined('DEV_STAGE')){
|
||||
// // return;
|
||||
// }
|
||||
|
||||
if (!$config['kj_sitemap_seo_sitemap_ping_enable']) {
|
||||
return;
|
||||
}
|
||||
|
||||
//last time? 3 hours in between
|
||||
if ((int)$config['kj_sitemap_seo_sitemap_ping_time'] > 0 && (int)time() - $config['kj_sitemap_seo_sitemap_ping_time'] < 3600 * 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
$services = array(
|
||||
"http://www.bing.com/webmaster/ping.aspx?siteMap=",
|
||||
"http://www.bing.com/ping?sitemap=",
|
||||
"http://submissions.ask.com/ping?sitemap=",
|
||||
"http://www.google.com/webmasters/sitemaps/ping?sitemap=",
|
||||
"http://api.moreover.com/ping?sitemap=",
|
||||
);
|
||||
|
||||
foreach ($services as $sv) {
|
||||
$curl_handle = curl_init();
|
||||
curl_setopt($curl_handle, CURLOPT_URL, $sv . rtrim($config['siteurl'], '/') . '/go.php?go=sitemap');
|
||||
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
|
||||
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
|
||||
$buffer = curl_exec($curl_handle);
|
||||
curl_close($curl_handle);
|
||||
}
|
||||
|
||||
update_config('kj_sitemap_seo_sitemap_ping_time', time());
|
||||
|
||||
//TODO add last time of ping to admin start page
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 10 KiB |
@@ -1,63 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,160 +0,0 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# kj_x_sendfile
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM'))
|
||||
{
|
||||
exit();
|
||||
}
|
||||
|
||||
//
|
||||
// this plugin is under heavy testing,
|
||||
// you should also test it and send your test results to us. (github.com/awssat/kleeja)
|
||||
//
|
||||
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['kj_x_sendfile']['information'] = array(
|
||||
# The casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'Kleeja X SendFile',
|
||||
'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' => 'Enable x-sendfile or X-Accel-Redirect for both Apache or Nginx for better performance.',
|
||||
'ar' => 'كليجا إكس سيند فايل'
|
||||
),
|
||||
# Min version of Kleeja that's requiered to run this plugin
|
||||
'plugin_kleeja_version_min' => '3.0',
|
||||
# Max version of Kleeja that support this plugin, use 0 for unlimited
|
||||
'plugin_kleeja_version_max' => '3.9',
|
||||
# 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_x_sendfile']['first_run']['en'] = "
|
||||
Thanks for using our klj_x_sendfile plugin.
|
||||
\n To report bugs reach us on: \nhttps://github.com/awssat/kleeja/issues
|
||||
\n\n
|
||||
You can find configurations on settings->kleeja x sendfile.
|
||||
|
||||
\n\n
|
||||
This plugin require that xsendfile is enabled on either Apache or Nginx:\n
|
||||
- Apache: https://tn123.org/mod_xsendfile/ \n
|
||||
- Nginx: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/
|
||||
|
||||
\n\n
|
||||
Do NOT use this plugin if you are not certain of your server configuration.
|
||||
";
|
||||
$kleeja_plugin['kj_x_sendfile']['first_run']['ar'] = "
|
||||
شكراً لإستخدام إضافة كليجا إكس سيند فايل. للإبلاغ عن الأخطاء : \n
|
||||
https://github.com/awssat/kleeja/issues
|
||||
\n\n
|
||||
You can find configurations on settings->kleeja x sendfile.
|
||||
|
||||
\n\n
|
||||
لاحظ أن هذه الإضافة تتطلب وجود sendfile مفعل على إما خادم انجين اكس او اباتشي:\n
|
||||
- Apache: https://tn123.org/mod_xsendfile/ \n
|
||||
- Nginx: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/
|
||||
|
||||
\n\n
|
||||
لا تستخدم هذه الإضافة إذا كنت غير متأكد من إعدادات خادمك وتوفر المتطلبات.
|
||||
";
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['kj_x_sendfile']['install'] = function($plg_id)
|
||||
{
|
||||
//new options
|
||||
$options = array(
|
||||
'kj_x_sendfile_enable' =>
|
||||
array(
|
||||
'value'=> '0',
|
||||
'html' => configField('kj_x_sendfile_enable', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_x_sendfile',
|
||||
),
|
||||
'kj_x_sendfile_type' =>
|
||||
array(
|
||||
'value'=> 'apache',
|
||||
'html' => configField('kj_x_sendfile_type', 'select', ['Apache' => 'apache', 'Nginx' => 'nginx']),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'kj_x_sendfile',
|
||||
),
|
||||
);
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'KJ_X_SENDFILE_ENABLE' => 'تفعيل هيدر x-Sendfile/X-Accel-Redirect',
|
||||
'KJ_X_SENDFILE_TYPE' => 'نوع الخادم',
|
||||
'CONFIG_KLJ_MENUS_KJ_X_SENDFILE' => 'كليجا إكس سيند فايل',
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'KJ_X_SENDFILE_ENABLE' => 'Enable x-Sendfile/X-Accel-Redirect',
|
||||
'KJ_X_SENDFILE_TYPE' => 'Current Server for your hosting',
|
||||
'CONFIG_KLJ_MENUS_KJ_X_SENDFILE' => 'Kleeja X Sendfile',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//Plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['kj_x_sendfile']['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
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
# Plugin Uninstallation, function to be called at unistalling
|
||||
$kleeja_plugin['kj_x_sendfile']['uninstall'] = function($plg_id)
|
||||
{
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'kj_x_sendfile_enable',
|
||||
'kj_x_sendfile_type'
|
||||
));
|
||||
|
||||
//delete language variables
|
||||
foreach (['ar', 'en'] as $language) {
|
||||
delete_olang(null, $language, $plg_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['kj_x_sendfile']['functions'] = array(
|
||||
|
||||
'do_page_before_headers_set' => function($args){
|
||||
global $config;
|
||||
|
||||
if($config['kj_x_sendfile_enable'] == 0)
|
||||
return;
|
||||
|
||||
if($config['kj_x_sendfile_type'] == 'apache')
|
||||
header('X-Sendfile: ' . $args['path_file']);
|
||||
else
|
||||
header('X-Accel-Redirect: ' . ltrim($args['path_file'], '.'));
|
||||
}
|
||||
);
|
||||
|
Before Width: | Height: | Size: 102 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,273 +0,0 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# klj_adfly
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['klj_adfly']['information'] = array(
|
||||
# The casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'adf.ly for Kleeja',
|
||||
'ar' => 'روابط adf.ly لكليجا'
|
||||
),
|
||||
# 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' => 'Generate a links using adf.ly service',
|
||||
'ar' => 'دعم Adf.ly في كليجا وإنشاء روابط ربحية تلقائياً'
|
||||
),
|
||||
# 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.9',
|
||||
# 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['klj_adfly']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك إضافة adf.ly ، قم بإعلامنا بالأخطاء عند ظهورها على: <br>
|
||||
https://github.com/awssat/kleeja/issues
|
||||
<hr>
|
||||
<br>
|
||||
<h3>لاحظ:</h3>
|
||||
<b>تجد إعدادات الإضافة في : إعدادات المركز->خيارات adf.ly</b>
|
||||
<br>
|
||||
<br>
|
||||
-------
|
||||
<h3>معلومات قد تفيدك: </h3>
|
||||
- <a href='https://join-adf.ly/17806729'>إضغط هنا للتسجيل في adf.ly</a> <br>
|
||||
";
|
||||
|
||||
$kleeja_plugin['klj_adfly']['first_run']['en'] = "
|
||||
Thanks for using adf.ly plugin, to report bugs:
|
||||
<br>
|
||||
https://github.com/awssat/kleeja/issues
|
||||
<hr>
|
||||
<br>
|
||||
<h3>Note:</h3>
|
||||
<b>You can find the settings at: Settings -> adf.ly Settings</b>
|
||||
<br>
|
||||
<br>
|
||||
-------
|
||||
<h3>Extra Info: </h3>
|
||||
- <a href='https://join-adf.ly/17806729' target='_blank'>Create your adf.ly now!</a> <br>
|
||||
";
|
||||
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['klj_adfly']['install'] = function ($plg_id) {
|
||||
//new options
|
||||
$options = array(
|
||||
'klj_adfly_enable' =>
|
||||
array(
|
||||
'value' => '0',
|
||||
'html' => configField('klj_adfly_enable', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'klj_adfly'
|
||||
),
|
||||
'klj_adfly_images_enable' =>
|
||||
array(
|
||||
'value' => '0',
|
||||
'html' => configField('klj_adfly_images_enable', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'klj_adfly'
|
||||
),
|
||||
'klj_adfly_user_id' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('klj_adfly_user_id'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'klj_adfly'
|
||||
),
|
||||
'klj_adfly_api_code' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('klj_adfly_api_code'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'klj_adfly'
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'KLJ_ADFLY_ENABLE' => 'تفعيل adf.ly',
|
||||
'KLJ_ADFLY_IMAGES_ENABLE' => 'تفعيل adf.ly للصور',
|
||||
'KLJ_ADFLY_API_CODE' => 'كود الربط API لـ adf.ly',
|
||||
'KLJ_ADFLY_USER_ID' => 'رقم المستخدم لـ adf.ly',
|
||||
'CONFIG_KLJ_MENUS_KLJ_ADFLY' => 'خيارات adf.ly',
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'KLJ_ADFLY_ENABLE' => 'Enable adf.ly',
|
||||
'KLJ_ADFLY_IMAGES_ENABLE' => 'Enable adf.ly for images',
|
||||
'KLJ_ADFLY_API_CODE' => 'Your API code of adf.ly',
|
||||
'KLJ_ADFLY_USER_ID' => 'Your user ID of adf.ly',
|
||||
'CONFIG_KLJ_MENUS_KLJ_ADFLY' => 'adf.ly Settings',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//Plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['klj_adfly']['update'] = function ($old_version, $new_version) {
|
||||
|
||||
$plg_id = Plugins::getInstance()->installed_plugin_info('klj_adfly');
|
||||
|
||||
if(version_compare($old_version, '1.1', '<')){
|
||||
$options = array(
|
||||
'klj_adfly_images_enable' =>
|
||||
array(
|
||||
'value' => '0',
|
||||
'html' => configField('klj_adfly_images_enable', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'klj_adfly'
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'KLJ_ADFLY_IMAGES_ENABLE' => 'تفعيل adf.ly للصور',
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'KLJ_ADFLY_IMAGES_ENABLE' => 'Enable adf.ly for images',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# Plugin Uninstallation, function to be called at unistalling
|
||||
$kleeja_plugin['klj_adfly']['uninstall'] = function ($plg_id) {
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'klj_adfly_enable',
|
||||
'klj_adfly_images_enable',
|
||||
'klj_adfly_api_code',
|
||||
'klj_adfly_user_id'
|
||||
));
|
||||
|
||||
//delete language variables
|
||||
foreach (array('ar', 'en') as $language) {
|
||||
delete_olang(null, $language, $plg_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['klj_adfly']['functions'] = array(
|
||||
'kleeja_get_link_func2' => function ($args) {
|
||||
global $config;
|
||||
|
||||
if (!$config['klj_adfly_enable']) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(defined('IN_REAL_INDEX'))
|
||||
{
|
||||
$link = $args['return_link'];
|
||||
$current_pid = $args['pid'];
|
||||
|
||||
|
||||
if($current_pid !== 'file' && $current_pid !== 'image') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if($current_pid === 'image' && !$config['klj_adfly_images_enable']){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$return_link = generate_klj_adfly_link($link);
|
||||
|
||||
return compact('return_link');
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* special functions
|
||||
*/
|
||||
|
||||
if (!function_exists('generate_klj_adfly_link')) {
|
||||
function generate_klj_adfly_link($link)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
||||
if (!$config['klj_adfly_enable']) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
if (empty($config['klj_adfly_api_code'])) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
if (empty($config['klj_adfly_user_id'])) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//TODO make it option
|
||||
$domain = 'adf.ly';
|
||||
$advert_type = 'int';
|
||||
|
||||
|
||||
$api = 'http://api.adf.ly/api.php?';
|
||||
|
||||
// api queries
|
||||
$query = array(
|
||||
'key' => $config['klj_adfly_api_code'],
|
||||
'uid' => $config['klj_adfly_user_id'],
|
||||
'advert_type' => $advert_type,
|
||||
'domain' => $domain,
|
||||
'url' => $link
|
||||
);
|
||||
|
||||
|
||||
$service_url = $api . http_build_query($query);
|
||||
|
||||
|
||||
$received_data = fetch_remote_file($service_url);
|
||||
|
||||
|
||||
if(empty($received_data))
|
||||
{
|
||||
return $link;
|
||||
}
|
||||
|
||||
return $received_data;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 11 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,169 +0,0 @@
|
||||
<?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.9',
|
||||
# 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;
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
<script>
|
||||
function toggleMenuItem(name, menu, hide, current) {
|
||||
$.ajax({
|
||||
url: '{action}&toggle=' + hide + '&_ajax_=1&menu=' + menu + '&name=' + name + '&{H_FORM_KEYS_GET}',
|
||||
dataType: 'json',
|
||||
cache: false})
|
||||
.done(function (data) {
|
||||
if(data.content){
|
||||
$('#pageErrors>span').html(data.content);
|
||||
$('#pageErrors').removeClass('d-none alert-danger').addClass('alert-info');
|
||||
|
||||
} else {
|
||||
this.fail();
|
||||
}
|
||||
})
|
||||
.fail(function(data) {
|
||||
$('#pageErrors>span').html((data.content ? data.content : (data.responseJSON ? data.responseJSON.content : '{lang.ERROR_TRY_AGAIN}')));
|
||||
$('#pageErrors').removeClass('d-none alert-info').addClass('alert-danger');
|
||||
var itemRemoveClass = current == 1 ? 'cb-disable' : 'cb-enable';
|
||||
var itemAddClass = current == 0 ? 'cb-disable' : 'cb-enable';
|
||||
$('#' + menu + '_menu_'+name + ' .' + itemRemoveClass).addClass('selected');
|
||||
$('#' + menu + '_menu_'+name + ' .' + itemAddClass).removeClass('selected');
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="alert alert-info alert-dismissible fixed-top m-3 p-0 text-center small d-none" id="pageErrors">
|
||||
<span>...</span>
|
||||
<button type="button" class="close py-0" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true" class="small" style="cursor:pointer">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Breadcrumbs -->
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="./">{lang.R_CPINDEX}</a></li>
|
||||
<li class="breadcrumb-item"><a href="./?cp=options">{lang.R_CONFIGS}</a></li>
|
||||
<li class="breadcrumb-item active">{olang.R_MENUS_TOGGLE}</li>
|
||||
</ol>
|
||||
|
||||
<div class="alert alert-light">{olang.MENU_TOGGLE_EXP}</div>
|
||||
|
||||
<div class="p-3">
|
||||
|
||||
<h4 class="mt-4">{olang.MENU_TOGGLE_TOP_MENU}</h4>
|
||||
|
||||
<ul class="list-group">
|
||||
<LOOP NAME="top_menu_items">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<div class="col col-md-auto">
|
||||
<h5>{{title}}</h5>
|
||||
</div>
|
||||
<div class="col col-md-auto">
|
||||
<p class="field switch" id="top_menu_{{name}}">
|
||||
<label onclick="toggleMenuItem('{{name}}', 'top', 0, {{hidden}})" class="cb-enable<IF LOOP="hidden == 0"> selected</IF>"><span>{olang.MENU_TOGGLE_SHOW}</span></label>
|
||||
<label onclick="toggleMenuItem('{{name}}', 'top', 1, {{hidden}})" class="cb-disable<IF LOOP="hidden == 1"> selected</IF>"><span>{olang.MENU_TOGGLE_HIDE}</span></label>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</LOOP>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h4 class="mt-5">{olang.MENU_TOGGLE_SIDE_MENU}</h4>
|
||||
|
||||
<ul class="list-group">
|
||||
<LOOP NAME="side_menu_items">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<div class="col col-md-auto">
|
||||
<h5>{{title}}</h5>
|
||||
</div>
|
||||
<div class="col col-md-auto">
|
||||
<p class="field switch" id="top_menu_{{name}}">
|
||||
<label onclick="toggleMenuItem('{{name}}', 'side', 0, {{hidden}})" class="cb-enable<IF LOOP="hidden == 0"> selected</IF>"><span>{olang.MENU_TOGGLE_SHOW}</span></label>
|
||||
<label onclick="toggleMenuItem('{{name}}', 'side', 1, {{hidden}})" class="cb-disable<IF LOOP="hidden == 1"> selected</IF>"><span>{olang.MENU_TOGGLE_HIDE}</span></label>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</LOOP>
|
||||
</ul>
|
||||
|
||||
|
||||
<h4 class="mt-5">{olang.MENU_TOGGLE_ADMIN_MENU}</h4>
|
||||
<UNLESS NAME="is_founder_admin">
|
||||
<div class="alert alert-light">{olang.MENU_TOGGLE_ADMIN_MENU_EXP}</div>
|
||||
<ELSE>
|
||||
<ul class="list-group">
|
||||
<LOOP NAME="admin_menu_items">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<div class="col col-md-auto">
|
||||
<h5>{{title}}</h5>
|
||||
</div>
|
||||
<div class="col col-md-auto">
|
||||
<p class="field switch" id="top_menu_{{name}}">
|
||||
<label onclick="toggleMenuItem('{{name}}', 'admin', 0, {{hidden}})" class="cb-enable<IF LOOP="hidden == 0"> selected</IF>"><span>{olang.MENU_TOGGLE_SHOW}</span></label>
|
||||
<label onclick="toggleMenuItem('{{name}}', 'admin', 1, {{hidden}})" class="cb-disable<IF LOOP="hidden == 1"> selected</IF>"><span>{olang.MENU_TOGGLE_HIDE}</span></label>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</LOOP>
|
||||
</ul>
|
||||
</UNLESS>
|
||||
</div>
|
||||
|
Before Width: | Height: | Size: 86 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,223 +0,0 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# menu_toggle
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['menu_toggle']['information'] = array(
|
||||
# The casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'Menu Toggle',
|
||||
'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' => 'Ability to hide/show Kleeja Menu items',
|
||||
'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.9',
|
||||
# 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['menu_toggle']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك هذه الإضافة قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
$kleeja_plugin['menu_toggle']['first_run']['en'] = "
|
||||
Thanks for using this plugin, to report bugs contact us:
|
||||
<br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['menu_toggle']['install'] = function ($plg_id)
|
||||
{
|
||||
add_config_r(array(
|
||||
// 'menu_toggle_hide_all' =>
|
||||
// array(
|
||||
// 'value' => '0',
|
||||
// 'plg_id' => $plg_id,
|
||||
// 'type' => 'menu_toggle'
|
||||
// ),
|
||||
'menu_toggle_hidden_topmenu_items' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'menu_toggle'
|
||||
),
|
||||
'menu_toggle_hidden_sidemenu_items' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'menu_toggle'
|
||||
),
|
||||
'menu_toggle_hidden_adminmenu_items' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'menu_toggle'
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'R_MENUS_TOGGLE' => 'تحكم بقوائم كليجا',
|
||||
'MENU_TOGGLE_EXP' => 'يمكنك التحكم بالعناصر التي تريد عرضها أو إخفائها من قوائم كليجا.',
|
||||
'MENU_TOGGLE_TOP_MENU' => 'القائمة العلوية',
|
||||
'MENU_TOGGLE_SIDE_MENU' => 'القائمة الجانبية',
|
||||
'MENU_TOGGLE_ADMIN_MENU' => 'قائمة لوحة التحكم',
|
||||
'MENU_TOGGLE_ADMIN_MENU_EXP' => 'يجب أن تكون عضو في مجموعة المسؤولين، وتملك صلاحية مؤسس لتستطيع التحكم بقائمة لوحة التحكم.',
|
||||
'MENU_TOGGLE_HIDE' => 'إخفاء',
|
||||
'MENU_TOGGLE_SHOW' => 'عرض',
|
||||
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'R_MENUS_TOGGLE' => 'Menus Toggle',
|
||||
'MENU_TOGGLE_EXP' => 'You can control which items you want to hide/show of Kleeja menus.',
|
||||
'MENU_TOGGLE_TOP_MENU' => 'Top Menu',
|
||||
'MENU_TOGGLE_SIDE_MENU' => 'Side Menu',
|
||||
'MENU_TOGGLE_ADMIN_MENU' => 'Admin Panel Menu',
|
||||
'MENU_TOGGLE_ADMIN_MENU_EXP' => 'You have to be a member in Administrators group and have the founder permissions to be able to control Admin panel menu items.',
|
||||
'MENU_TOGGLE_HIDE' => 'hide',
|
||||
'MENU_TOGGLE_SHOW' => 'show',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//Plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['menu_toggle']['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['menu_toggle']['uninstall'] = function ($plg_id) {
|
||||
//delete language variables
|
||||
delete_olang(null, null, $plg_id);
|
||||
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'menu_toggle_hidden_topmenu_items',
|
||||
'menu_toggle_hidden_sidemenu_items',
|
||||
'menu_toggle_hidden_adminmenu_items'
|
||||
));
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['menu_toggle']['functions'] = array(
|
||||
//add to admin menu
|
||||
'require_admin_page_end_a_configs' => function($args) {
|
||||
global $olang;
|
||||
$go_menu = $args['go_menu'];
|
||||
$last_item = $go_menu['all'];
|
||||
unset($go_menu['all']);
|
||||
$go_menu['menus_toggle'] = array(
|
||||
'name' => $olang['R_MENUS_TOGGLE'],
|
||||
'link' => './?cp=menus_toggle',
|
||||
'goto' => 'menus_toggle',
|
||||
'current' => g('cp') == 'menus_toggle'
|
||||
);
|
||||
|
||||
$go_menu['all'] = $last_item;
|
||||
|
||||
return compact('go_menu');
|
||||
},
|
||||
|
||||
'begin_admin_page' => function ($args) {
|
||||
global $config;
|
||||
$adm_extensions = $args['adm_extensions'];
|
||||
$adm_extensions[] = 'menus_toggle';
|
||||
|
||||
$hidden_admin_menu_items = explode(':', $config['menu_toggle_hidden_adminmenu_items'] . ':menus_toggle');
|
||||
$hidden_admin_menu_items = array_filter($hidden_admin_menu_items);
|
||||
|
||||
$ext_expt = array_merge($args['ext_expt'], $hidden_admin_menu_items);
|
||||
|
||||
return compact('adm_extensions', 'ext_expt');
|
||||
},
|
||||
|
||||
'endforeach_ext_admin_page' => function($args) {
|
||||
if(g('cp') == 'menus_toggle')
|
||||
{
|
||||
$adm_extensions_menu = $args['adm_extensions_menu'];
|
||||
$adm_extensions_menu[1]['current'] = true;
|
||||
return compact('adm_extensions_menu');
|
||||
}
|
||||
},
|
||||
|
||||
//add as admin page to reach when click on admin menu item we added.
|
||||
'not_exists_menus_toggle' => function () {
|
||||
$include_alternative = dirname(__FILE__) . '/menus_toggle.php';
|
||||
|
||||
return compact('include_alternative');
|
||||
},
|
||||
|
||||
'Saaheader_links_func' => function($args){
|
||||
|
||||
global $config;
|
||||
|
||||
$return = [];
|
||||
|
||||
foreach(array('top', 'side') as $menu)
|
||||
{
|
||||
if(trim($config['menu_toggle_hidden_'.$menu.'menu_items']) != '')
|
||||
{
|
||||
$current_menu = $args[$menu.'_menu'];
|
||||
|
||||
$hidden_items = explode(':', $config['menu_toggle_hidden_'.$menu.'menu_items']);
|
||||
$hidden_items = array_filter($hidden_items);
|
||||
$new_menu = array();
|
||||
foreach($current_menu as $order => $item)
|
||||
{
|
||||
if(! in_array($item['name'], $hidden_items))
|
||||
{
|
||||
$new_menu[$order] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$return[$menu . '_menu'] = $new_menu;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(sizeof($return))
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
<?php
|
||||
|
||||
// not for directly open
|
||||
if (! defined('IN_ADMIN'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
#current template
|
||||
$stylee = 'admin_menus_toggle';
|
||||
|
||||
// template variables
|
||||
$styleePath = dirname(__FILE__);
|
||||
|
||||
$H_FORM_KEYS_GET = kleeja_add_form_key_get('adm_menus_toggle');
|
||||
|
||||
$action = basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php');
|
||||
|
||||
$hidden_side_menu_items = explode(':', $config['menu_toggle_hidden_sidemenu_items']);
|
||||
|
||||
$is_founder_admin = intval($userinfo['founder']) === 1;
|
||||
|
||||
$side_menu_items = array(
|
||||
array('name' => 'profile', 'title' => $lang['PROFILE'], 'hidden' => (int) in_array('profile', $hidden_side_menu_items)),
|
||||
array('name' => 'fileuser', 'title' => $lang['YOUR_FILEUSER'], 'hidden' => (int) in_array('fileuser', $hidden_side_menu_items)),
|
||||
array('name' => 'logout', 'title' => $lang['LOGOUT'], 'hidden' => (int) in_array('logout', $hidden_side_menu_items)),
|
||||
array('name' => 'login', 'title' => $lang['LOGIN'], 'hidden' => (int) in_array('login', $hidden_side_menu_items)),
|
||||
array('name' => 'register', 'title' => $lang['REGISTER'], 'hidden' => (int) in_array('register', $hidden_side_menu_items)),
|
||||
);
|
||||
|
||||
$hidden_top_menu_items = explode(':', $config['menu_toggle_hidden_topmenu_items']);
|
||||
|
||||
$top_menu_items = array(
|
||||
array('name' => 'index', 'title' => $lang['INDEX'], 'hidden' => (int) in_array('index', $hidden_top_menu_items)),
|
||||
array('name' => 'rules', 'title' => $lang['RULES'], 'hidden' => (int) in_array('rules', $hidden_top_menu_items)),
|
||||
array('name' => 'guide', 'title' => $lang['GUIDE'], 'hidden' => (int) in_array('guide', $hidden_top_menu_items)),
|
||||
array('name' => 'stats', 'title' => $lang['STATS'], 'hidden' => (int) in_array('stats', $hidden_top_menu_items)),
|
||||
array('name' => 'report', 'title' => $lang['REPORT'], 'hidden' => (int) in_array('report', $hidden_top_menu_items)),
|
||||
array('name' => 'call', 'title' => $lang['CALL'], 'hidden' => (int) in_array('call', $hidden_top_menu_items)),
|
||||
);
|
||||
|
||||
$hidden_admin_menu_items = explode(':', $config['menu_toggle_hidden_adminmenu_items']);
|
||||
|
||||
$admin_menu_items = array();
|
||||
foreach($adm_extensions as $item)
|
||||
{
|
||||
$m = isset($item[1]) && $item[1] == '_' ? substr($item, 2) : $item;
|
||||
|
||||
if(in_array($m, array('start', 'lgoutcp', 'exts', 'configs')))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$admin_menu_items[] = array(
|
||||
'name' => $item,
|
||||
'title' => !empty($lang['R_' . strtoupper($m)]) ? $lang['R_' . strtoupper($m)] : (!empty($olang['R_' . strtoupper($m)]) ? $olang['R_' . strtoupper($m)] : strtoupper($m)),
|
||||
'hidden' => (int) in_array($item, $hidden_admin_menu_items)
|
||||
);
|
||||
}
|
||||
|
||||
$go_menu = array(
|
||||
'menus_toggle' => array('name' => $olang['R_MENUS_TOGGLE'], 'link' => './?cp=menus_toggle', 'goto' => 'menus_toggle', 'current' => g('cp') == 'menus_toggle')
|
||||
);
|
||||
|
||||
if(ig('toggle'))
|
||||
{
|
||||
if (! kleeja_check_form_key_get('adm_menus_toggle', 3600))
|
||||
{
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
$adminAjaxContent = $lang['INVALID_FORM_KEY'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = g('name');
|
||||
$menu = g('menu');
|
||||
$hide = g('toggle', 'int') == 1;
|
||||
|
||||
if($menu == 'admin' && ! $is_founder_admin)
|
||||
{
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
$adminAjaxContent = $lang['HV_NOT_PRVLG_ACCESS'];
|
||||
}
|
||||
else
|
||||
{
|
||||
toggleMenuItem($name, $menu, $hide);
|
||||
|
||||
$adminAjaxContent = $lang['CONFIGS_UPDATED'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleMenuItem($name, $menu, $hide)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$items = explode(':', $config['menu_toggle_hidden_'.$menu.'menu_items']);
|
||||
$items = array_filter($items);
|
||||
|
||||
if(in_array($name, $items) && ! $hide)
|
||||
{
|
||||
$new_items = array_diff($items, [$name]);
|
||||
}
|
||||
else if($hide)
|
||||
{
|
||||
$new_items = $items;
|
||||
$new_items[] = $name;
|
||||
}
|
||||
|
||||
if($new_items != $items)
|
||||
{
|
||||
update_config('menu_toggle_hidden_' . $menu . 'menu_items', implode(':', $new_items));
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 92 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,141 +0,0 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# pdf_viewer
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['pdf_viewer']['information'] = array(
|
||||
# The casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'PDF Viewer',
|
||||
'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' => 'Integrate a PDF viewer in download 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.9',
|
||||
# Should this plugin run before others?, 0 is normal, and higher number has high priority
|
||||
'plugin_priority' => 10
|
||||
);
|
||||
|
||||
//after installation message, you can remove it, it's not required
|
||||
$kleeja_plugin['pdf_viewer']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك هذه الإضافة قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
$kleeja_plugin['pdf_viewer']['first_run']['en'] = "
|
||||
Thanks for using this plugin, to report bugs contact us:
|
||||
<br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['pdf_viewer']['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['pdf_viewer']['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['pdf_viewer']['uninstall'] = function ($plg_id) {
|
||||
//delete language variables
|
||||
// foreach (array('ar', 'en') as $language) {
|
||||
// delete_olang(null, $language, $plg_id);
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['pdf_viewer']['functions'] = array(
|
||||
|
||||
|
||||
'style_parse_func' => function($args) {
|
||||
global $config;
|
||||
|
||||
|
||||
if($args['template_name'] == 'download') {
|
||||
|
||||
|
||||
$x = PHP_EOL . '<IF NAME="show_pdf_viewer_code">
|
||||
<div style="clear: both;"></div>
|
||||
<div id="pdfViewer" style="margin-top: 20px; position: relative; height: 0; overflow: hidden; padding-bottom: 80%;">
|
||||
<iframe style="position: absolute; top:0; left: 0; width: 100%; height: 100%;" src = "' . $config['siteurl'] . 'plugins/pdf_viewer/v/#{pdf_path}" allowfullscreen webkitallowfullscreen></iframe>
|
||||
</div>
|
||||
</IF>';
|
||||
|
||||
|
||||
$html = $args['html'] . $x;
|
||||
|
||||
return compact('html');
|
||||
}
|
||||
},
|
||||
|
||||
'b4_showsty_downlaod_id_filename' => function($args){
|
||||
|
||||
|
||||
$file_info = $args['file_info'];
|
||||
|
||||
$show_pdf_viewer_code = false;
|
||||
|
||||
$type_mimes = array(
|
||||
'pdf'
|
||||
);
|
||||
|
||||
if(in_array(strtolower($file_info['type']), $type_mimes)){
|
||||
|
||||
$show_pdf_viewer_code = true;
|
||||
|
||||
global $config;
|
||||
|
||||
$pdf_path = $config['siteurl'] . "{$file_info['folder']}/{$file_info['name']}";
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('plugin:pdf_viewer:do_display', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
}
|
||||
|
||||
return compact('show_pdf_viewer_code', 'pdf_path');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,577 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals VBArray, PDFJS */
|
||||
|
||||
'use strict';
|
||||
|
||||
// Initializing PDFJS global object here, it case if we need to change/disable
|
||||
// some PDF.js features, e.g. range requests
|
||||
if (typeof PDFJS === 'undefined') {
|
||||
(typeof window !== 'undefined' ? window : this).PDFJS = {};
|
||||
}
|
||||
|
||||
// Checking if the typed arrays are supported
|
||||
// Support: iOS<6.0 (subarray), IE<10, Android<4.0
|
||||
(function checkTypedArrayCompatibility() {
|
||||
if (typeof Uint8Array !== 'undefined') {
|
||||
// Support: iOS<6.0
|
||||
if (typeof Uint8Array.prototype.subarray === 'undefined') {
|
||||
Uint8Array.prototype.subarray = function subarray(start, end) {
|
||||
return new Uint8Array(this.slice(start, end));
|
||||
};
|
||||
Float32Array.prototype.subarray = function subarray(start, end) {
|
||||
return new Float32Array(this.slice(start, end));
|
||||
};
|
||||
}
|
||||
|
||||
// Support: Android<4.1
|
||||
if (typeof Float64Array === 'undefined') {
|
||||
window.Float64Array = Float32Array;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function subarray(start, end) {
|
||||
return new TypedArray(this.slice(start, end));
|
||||
}
|
||||
|
||||
function setArrayOffset(array, offset) {
|
||||
if (arguments.length < 2) {
|
||||
offset = 0;
|
||||
}
|
||||
for (var i = 0, n = array.length; i < n; ++i, ++offset) {
|
||||
this[offset] = array[i] & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
function TypedArray(arg1) {
|
||||
var result, i, n;
|
||||
if (typeof arg1 === 'number') {
|
||||
result = [];
|
||||
for (i = 0; i < arg1; ++i) {
|
||||
result[i] = 0;
|
||||
}
|
||||
} else if ('slice' in arg1) {
|
||||
result = arg1.slice(0);
|
||||
} else {
|
||||
result = [];
|
||||
for (i = 0, n = arg1.length; i < n; ++i) {
|
||||
result[i] = arg1[i];
|
||||
}
|
||||
}
|
||||
|
||||
result.subarray = subarray;
|
||||
result.buffer = result;
|
||||
result.byteLength = result.length;
|
||||
result.set = setArrayOffset;
|
||||
|
||||
if (typeof arg1 === 'object' && arg1.buffer) {
|
||||
result.buffer = arg1.buffer;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
window.Uint8Array = TypedArray;
|
||||
window.Int8Array = TypedArray;
|
||||
|
||||
// we don't need support for set, byteLength for 32-bit array
|
||||
// so we can use the TypedArray as well
|
||||
window.Uint32Array = TypedArray;
|
||||
window.Int32Array = TypedArray;
|
||||
window.Uint16Array = TypedArray;
|
||||
window.Float32Array = TypedArray;
|
||||
window.Float64Array = TypedArray;
|
||||
})();
|
||||
|
||||
// URL = URL || webkitURL
|
||||
// Support: Safari<7, Android 4.2+
|
||||
(function normalizeURLObject() {
|
||||
if (!window.URL) {
|
||||
window.URL = window.webkitURL;
|
||||
}
|
||||
})();
|
||||
|
||||
// Object.defineProperty()?
|
||||
// Support: Android<4.0, Safari<5.1
|
||||
(function checkObjectDefinePropertyCompatibility() {
|
||||
if (typeof Object.defineProperty !== 'undefined') {
|
||||
var definePropertyPossible = true;
|
||||
try {
|
||||
// some browsers (e.g. safari) cannot use defineProperty() on DOM objects
|
||||
// and thus the native version is not sufficient
|
||||
Object.defineProperty(new Image(), 'id', { value: 'test' });
|
||||
// ... another test for android gb browser for non-DOM objects
|
||||
var Test = function Test() {};
|
||||
Test.prototype = { get id() { } };
|
||||
Object.defineProperty(new Test(), 'id',
|
||||
{ value: '', configurable: true, enumerable: true, writable: false });
|
||||
} catch (e) {
|
||||
definePropertyPossible = false;
|
||||
}
|
||||
if (definePropertyPossible) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty = function objectDefineProperty(obj, name, def) {
|
||||
delete obj[name];
|
||||
if ('get' in def) {
|
||||
obj.__defineGetter__(name, def['get']);
|
||||
}
|
||||
if ('set' in def) {
|
||||
obj.__defineSetter__(name, def['set']);
|
||||
}
|
||||
if ('value' in def) {
|
||||
obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
|
||||
this.__defineGetter__(name, function objectDefinePropertyGetter() {
|
||||
return value;
|
||||
});
|
||||
return value;
|
||||
});
|
||||
obj[name] = def.value;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
// No XMLHttpRequest#response?
|
||||
// Support: IE<11, Android <4.0
|
||||
(function checkXMLHttpRequestResponseCompatibility() {
|
||||
var xhrPrototype = XMLHttpRequest.prototype;
|
||||
var xhr = new XMLHttpRequest();
|
||||
if (!('overrideMimeType' in xhr)) {
|
||||
// IE10 might have response, but not overrideMimeType
|
||||
// Support: IE10
|
||||
Object.defineProperty(xhrPrototype, 'overrideMimeType', {
|
||||
value: function xmlHttpRequestOverrideMimeType(mimeType) {}
|
||||
});
|
||||
}
|
||||
if ('responseType' in xhr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The worker will be using XHR, so we can save time and disable worker.
|
||||
PDFJS.disableWorker = true;
|
||||
|
||||
Object.defineProperty(xhrPrototype, 'responseType', {
|
||||
get: function xmlHttpRequestGetResponseType() {
|
||||
return this._responseType || 'text';
|
||||
},
|
||||
set: function xmlHttpRequestSetResponseType(value) {
|
||||
if (value === 'text' || value === 'arraybuffer') {
|
||||
this._responseType = value;
|
||||
if (value === 'arraybuffer' &&
|
||||
typeof this.overrideMimeType === 'function') {
|
||||
this.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Support: IE9
|
||||
if (typeof VBArray !== 'undefined') {
|
||||
Object.defineProperty(xhrPrototype, 'response', {
|
||||
get: function xmlHttpRequestResponseGet() {
|
||||
if (this.responseType === 'arraybuffer') {
|
||||
return new Uint8Array(new VBArray(this.responseBody).toArray());
|
||||
} else {
|
||||
return this.responseText;
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Object.defineProperty(xhrPrototype, 'response', {
|
||||
get: function xmlHttpRequestResponseGet() {
|
||||
if (this.responseType !== 'arraybuffer') {
|
||||
return this.responseText;
|
||||
}
|
||||
var text = this.responseText;
|
||||
var i, n = text.length;
|
||||
var result = new Uint8Array(n);
|
||||
for (i = 0; i < n; ++i) {
|
||||
result[i] = text.charCodeAt(i) & 0xFF;
|
||||
}
|
||||
return result.buffer;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
// window.btoa (base64 encode function) ?
|
||||
// Support: IE<10
|
||||
(function checkWindowBtoaCompatibility() {
|
||||
if ('btoa' in window) {
|
||||
return;
|
||||
}
|
||||
|
||||
var digits =
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
|
||||
window.btoa = function windowBtoa(chars) {
|
||||
var buffer = '';
|
||||
var i, n;
|
||||
for (i = 0, n = chars.length; i < n; i += 3) {
|
||||
var b1 = chars.charCodeAt(i) & 0xFF;
|
||||
var b2 = chars.charCodeAt(i + 1) & 0xFF;
|
||||
var b3 = chars.charCodeAt(i + 2) & 0xFF;
|
||||
var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);
|
||||
var d3 = i + 1 < n ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;
|
||||
var d4 = i + 2 < n ? (b3 & 0x3F) : 64;
|
||||
buffer += (digits.charAt(d1) + digits.charAt(d2) +
|
||||
digits.charAt(d3) + digits.charAt(d4));
|
||||
}
|
||||
return buffer;
|
||||
};
|
||||
})();
|
||||
|
||||
// window.atob (base64 encode function)?
|
||||
// Support: IE<10
|
||||
(function checkWindowAtobCompatibility() {
|
||||
if ('atob' in window) {
|
||||
return;
|
||||
}
|
||||
|
||||
// https://github.com/davidchambers/Base64.js
|
||||
var digits =
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
window.atob = function (input) {
|
||||
input = input.replace(/=+$/, '');
|
||||
if (input.length % 4 === 1) {
|
||||
throw new Error('bad atob input');
|
||||
}
|
||||
for (
|
||||
// initialize result and counters
|
||||
var bc = 0, bs, buffer, idx = 0, output = '';
|
||||
// get next character
|
||||
buffer = input.charAt(idx++);
|
||||
// character found in table?
|
||||
// initialize bit storage and add its ascii value
|
||||
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
||||
// and if not first of each 4 characters,
|
||||
// convert the first 8 bits to one ascii character
|
||||
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
|
||||
) {
|
||||
// try to find character in table (0-63, not found => -1)
|
||||
buffer = digits.indexOf(buffer);
|
||||
}
|
||||
return output;
|
||||
};
|
||||
})();
|
||||
|
||||
// Function.prototype.bind?
|
||||
// Support: Android<4.0, iOS<6.0
|
||||
(function checkFunctionPrototypeBindCompatibility() {
|
||||
if (typeof Function.prototype.bind !== 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
Function.prototype.bind = function functionPrototypeBind(obj) {
|
||||
var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
|
||||
var bound = function functionPrototypeBindBound() {
|
||||
var args = headArgs.concat(Array.prototype.slice.call(arguments));
|
||||
return fn.apply(obj, args);
|
||||
};
|
||||
return bound;
|
||||
};
|
||||
})();
|
||||
|
||||
// HTMLElement dataset property
|
||||
// Support: IE<11, Safari<5.1, Android<4.0
|
||||
(function checkDatasetProperty() {
|
||||
var div = document.createElement('div');
|
||||
if ('dataset' in div) {
|
||||
return; // dataset property exists
|
||||
}
|
||||
|
||||
Object.defineProperty(HTMLElement.prototype, 'dataset', {
|
||||
get: function() {
|
||||
if (this._dataset) {
|
||||
return this._dataset;
|
||||
}
|
||||
|
||||
var dataset = {};
|
||||
for (var j = 0, jj = this.attributes.length; j < jj; j++) {
|
||||
var attribute = this.attributes[j];
|
||||
if (attribute.name.substring(0, 5) !== 'data-') {
|
||||
continue;
|
||||
}
|
||||
var key = attribute.name.substring(5).replace(/\-([a-z])/g,
|
||||
function(all, ch) {
|
||||
return ch.toUpperCase();
|
||||
});
|
||||
dataset[key] = attribute.value;
|
||||
}
|
||||
|
||||
Object.defineProperty(this, '_dataset', {
|
||||
value: dataset,
|
||||
writable: false,
|
||||
enumerable: false
|
||||
});
|
||||
return dataset;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
})();
|
||||
|
||||
// HTMLElement classList property
|
||||
// Support: IE<10, Android<4.0, iOS<5.0
|
||||
(function checkClassListProperty() {
|
||||
var div = document.createElement('div');
|
||||
if ('classList' in div) {
|
||||
return; // classList property exists
|
||||
}
|
||||
|
||||
function changeList(element, itemName, add, remove) {
|
||||
var s = element.className || '';
|
||||
var list = s.split(/\s+/g);
|
||||
if (list[0] === '') {
|
||||
list.shift();
|
||||
}
|
||||
var index = list.indexOf(itemName);
|
||||
if (index < 0 && add) {
|
||||
list.push(itemName);
|
||||
}
|
||||
if (index >= 0 && remove) {
|
||||
list.splice(index, 1);
|
||||
}
|
||||
element.className = list.join(' ');
|
||||
return (index >= 0);
|
||||
}
|
||||
|
||||
var classListPrototype = {
|
||||
add: function(name) {
|
||||
changeList(this.element, name, true, false);
|
||||
},
|
||||
contains: function(name) {
|
||||
return changeList(this.element, name, false, false);
|
||||
},
|
||||
remove: function(name) {
|
||||
changeList(this.element, name, false, true);
|
||||
},
|
||||
toggle: function(name) {
|
||||
changeList(this.element, name, true, true);
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(HTMLElement.prototype, 'classList', {
|
||||
get: function() {
|
||||
if (this._classList) {
|
||||
return this._classList;
|
||||
}
|
||||
|
||||
var classList = Object.create(classListPrototype, {
|
||||
element: {
|
||||
value: this,
|
||||
writable: false,
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
Object.defineProperty(this, '_classList', {
|
||||
value: classList,
|
||||
writable: false,
|
||||
enumerable: false
|
||||
});
|
||||
return classList;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
})();
|
||||
|
||||
// Check console compatibility
|
||||
// In older IE versions the console object is not available
|
||||
// unless console is open.
|
||||
// Support: IE<10
|
||||
(function checkConsoleCompatibility() {
|
||||
if (!('console' in window)) {
|
||||
window.console = {
|
||||
log: function() {},
|
||||
error: function() {},
|
||||
warn: function() {}
|
||||
};
|
||||
} else if (!('bind' in console.log)) {
|
||||
// native functions in IE9 might not have bind
|
||||
console.log = (function(fn) {
|
||||
return function(msg) { return fn(msg); };
|
||||
})(console.log);
|
||||
console.error = (function(fn) {
|
||||
return function(msg) { return fn(msg); };
|
||||
})(console.error);
|
||||
console.warn = (function(fn) {
|
||||
return function(msg) { return fn(msg); };
|
||||
})(console.warn);
|
||||
}
|
||||
})();
|
||||
|
||||
// Check onclick compatibility in Opera
|
||||
// Support: Opera<15
|
||||
(function checkOnClickCompatibility() {
|
||||
// workaround for reported Opera bug DSK-354448:
|
||||
// onclick fires on disabled buttons with opaque content
|
||||
function ignoreIfTargetDisabled(event) {
|
||||
if (isDisabled(event.target)) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
function isDisabled(node) {
|
||||
return node.disabled || (node.parentNode && isDisabled(node.parentNode));
|
||||
}
|
||||
if (navigator.userAgent.indexOf('Opera') !== -1) {
|
||||
// use browser detection since we cannot feature-check this bug
|
||||
document.addEventListener('click', ignoreIfTargetDisabled, true);
|
||||
}
|
||||
})();
|
||||
|
||||
// Checks if possible to use URL.createObjectURL()
|
||||
// Support: IE
|
||||
(function checkOnBlobSupport() {
|
||||
// sometimes IE loosing the data created with createObjectURL(), see #3977
|
||||
if (navigator.userAgent.indexOf('Trident') >= 0) {
|
||||
PDFJS.disableCreateObjectURL = true;
|
||||
}
|
||||
})();
|
||||
|
||||
// Checks if navigator.language is supported
|
||||
(function checkNavigatorLanguage() {
|
||||
if ('language' in navigator) {
|
||||
return;
|
||||
}
|
||||
PDFJS.locale = navigator.userLanguage || 'en-US';
|
||||
})();
|
||||
|
||||
(function checkRangeRequests() {
|
||||
// Safari has issues with cached range requests see:
|
||||
// https://github.com/mozilla/pdf.js/issues/3260
|
||||
// Last tested with version 6.0.4.
|
||||
// Support: Safari 6.0+
|
||||
var isSafari = Object.prototype.toString.call(
|
||||
window.HTMLElement).indexOf('Constructor') > 0;
|
||||
|
||||
// Older versions of Android (pre 3.0) has issues with range requests, see:
|
||||
// https://github.com/mozilla/pdf.js/issues/3381.
|
||||
// Make sure that we only match webkit-based Android browsers,
|
||||
// since Firefox/Fennec works as expected.
|
||||
// Support: Android<3.0
|
||||
var regex = /Android\s[0-2][^\d]/;
|
||||
var isOldAndroid = regex.test(navigator.userAgent);
|
||||
|
||||
// Range requests are broken in Chrome 39 and 40, https://crbug.com/442318
|
||||
var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(navigator.userAgent);
|
||||
|
||||
if (isSafari || isOldAndroid || isChromeWithRangeBug) {
|
||||
PDFJS.disableRange = true;
|
||||
PDFJS.disableStream = true;
|
||||
}
|
||||
})();
|
||||
|
||||
// Check if the browser supports manipulation of the history.
|
||||
// Support: IE<10, Android<4.2
|
||||
(function checkHistoryManipulation() {
|
||||
// Android 2.x has so buggy pushState support that it was removed in
|
||||
// Android 3.0 and restored as late as in Android 4.2.
|
||||
// Support: Android 2.x
|
||||
if (!history.pushState || navigator.userAgent.indexOf('Android 2.') >= 0) {
|
||||
PDFJS.disableHistory = true;
|
||||
}
|
||||
})();
|
||||
|
||||
// Support: IE<11, Chrome<21, Android<4.4, Safari<6
|
||||
(function checkSetPresenceInImageData() {
|
||||
// IE < 11 will use window.CanvasPixelArray which lacks set function.
|
||||
if (window.CanvasPixelArray) {
|
||||
if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
|
||||
window.CanvasPixelArray.prototype.set = function(arr) {
|
||||
for (var i = 0, ii = this.length; i < ii; i++) {
|
||||
this[i] = arr[i];
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// Old Chrome and Android use an inaccessible CanvasPixelArray prototype.
|
||||
// Because we cannot feature detect it, we rely on user agent parsing.
|
||||
var polyfill = false, versionMatch;
|
||||
if (navigator.userAgent.indexOf('Chrom') >= 0) {
|
||||
versionMatch = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
|
||||
// Chrome < 21 lacks the set function.
|
||||
polyfill = versionMatch && parseInt(versionMatch[2]) < 21;
|
||||
} else if (navigator.userAgent.indexOf('Android') >= 0) {
|
||||
// Android < 4.4 lacks the set function.
|
||||
// Android >= 4.4 will contain Chrome in the user agent,
|
||||
// thus pass the Chrome check above and not reach this block.
|
||||
polyfill = /Android\s[0-4][^\d]/g.test(navigator.userAgent);
|
||||
} else if (navigator.userAgent.indexOf('Safari') >= 0) {
|
||||
versionMatch = navigator.userAgent.
|
||||
match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//);
|
||||
// Safari < 6 lacks the set function.
|
||||
polyfill = versionMatch && parseInt(versionMatch[1]) < 6;
|
||||
}
|
||||
|
||||
if (polyfill) {
|
||||
var contextPrototype = window.CanvasRenderingContext2D.prototype;
|
||||
contextPrototype._createImageData = contextPrototype.createImageData;
|
||||
contextPrototype.createImageData = function(w, h) {
|
||||
var imageData = this._createImageData(w, h);
|
||||
imageData.data.set = function(arr) {
|
||||
for (var i = 0, ii = this.length; i < ii; i++) {
|
||||
this[i] = arr[i];
|
||||
}
|
||||
};
|
||||
return imageData;
|
||||
};
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
// Support: IE<10, Android<4.0, iOS
|
||||
(function checkRequestAnimationFrame() {
|
||||
function fakeRequestAnimationFrame(callback) {
|
||||
window.setTimeout(callback, 20);
|
||||
}
|
||||
|
||||
var isIOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
|
||||
if (isIOS) {
|
||||
// requestAnimationFrame on iOS is broken, replacing with fake one.
|
||||
window.requestAnimationFrame = fakeRequestAnimationFrame;
|
||||
return;
|
||||
}
|
||||
if ('requestAnimationFrame' in window) {
|
||||
return;
|
||||
}
|
||||
window.requestAnimationFrame =
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
fakeRequestAnimationFrame;
|
||||
})();
|
||||
|
||||
(function checkCanvasSizeLimitation() {
|
||||
var isIOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
|
||||
var isAndroid = /Android/g.test(navigator.userAgent);
|
||||
if (isIOS || isAndroid) {
|
||||
// 5MP
|
||||
PDFJS.maxCanvasPixels = 5242880;
|
||||
}
|
||||
})();
|
||||
|
||||
// Disable fullscreen support for certain problematic configurations.
|
||||
// Support: IE11+ (when embedded).
|
||||
(function checkFullscreenSupport() {
|
||||
var isEmbeddedIE = (navigator.userAgent.indexOf('Trident') >= 0 &&
|
||||
window.parent !== window);
|
||||
if (isEmbeddedIE) {
|
||||
PDFJS.disableFullscreen = true;
|
||||
}
|
||||
})();
|
||||
@@ -1,27 +0,0 @@
|
||||
/* This is just a sample file with CSS rules. You should write your own @font-face declarations
|
||||
* to add support for your desired fonts.
|
||||
*/
|
||||
|
||||
@font-face {
|
||||
font-family: 'Novecentowide Book';
|
||||
src: url("/ViewerJS/fonts/Novecentowide-Bold-webfont.eot");
|
||||
src: url("/ViewerJS/fonts/Novecentowide-Bold-webfont.eot?#iefix") format("embedded-opentype"),
|
||||
url("/ViewerJS/fonts/Novecentowide-Bold-webfont.woff") format("woff"),
|
||||
url("/fonts/Novecentowide-Bold-webfont.ttf") format("truetype"),
|
||||
url("/fonts/Novecentowide-Bold-webfont.svg#NovecentowideBookBold") format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'exotica';
|
||||
src: url('/ViewerJS/fonts/Exotica-webfont.eot');
|
||||
src: url('/ViewerJS/fonts/Exotica-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('/ViewerJS/fonts/Exotica-webfont.woff') format('woff'),
|
||||
url('/ViewerJS/fonts/Exotica-webfont.ttf') format('truetype'),
|
||||
url('/ViewerJS/fonts/Exotica-webfont.svg#exoticamedium') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 512 B |
|
Before Width: | Height: | Size: 491 B |
|
Before Width: | Height: | Size: 237 B |
|
Before Width: | Height: | Size: 353 B |
|
Before Width: | Height: | Size: 344 B |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 143 B |
39353
plugins/pdf_viewer/v/pdf.worker.js
vendored
@@ -1 +0,0 @@
|
||||
var /**@const{!string}*/pdfjs_version = "v1.1.114";
|
||||
@@ -1,419 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals CustomStyle, PDFJS */
|
||||
|
||||
'use strict';
|
||||
|
||||
var MAX_TEXT_DIVS_TO_RENDER = 100000;
|
||||
|
||||
var NonWhitespaceRegexp = /\S/;
|
||||
|
||||
function isAllWhitespace(str) {
|
||||
return !NonWhitespaceRegexp.test(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} TextLayerBuilderOptions
|
||||
* @property {HTMLDivElement} textLayerDiv - The text layer container.
|
||||
* @property {number} pageIndex - The page index.
|
||||
* @property {PageViewport} viewport - The viewport of the text layer.
|
||||
* @property {PDFFindController} findController
|
||||
*/
|
||||
|
||||
/**
|
||||
* TextLayerBuilder provides text-selection functionality for the PDF.
|
||||
* It does this by creating overlay divs over the PDF text. These divs
|
||||
* contain text that matches the PDF text they are overlaying. This object
|
||||
* also provides a way to highlight text that is being searched for.
|
||||
* @class
|
||||
*/
|
||||
var TextLayerBuilder = (function TextLayerBuilderClosure() {
|
||||
function TextLayerBuilder(options) {
|
||||
this.textLayerDiv = options.textLayerDiv;
|
||||
this.renderingDone = false;
|
||||
this.divContentDone = false;
|
||||
this.pageIdx = options.pageIndex;
|
||||
this.pageNumber = this.pageIdx + 1;
|
||||
this.matches = [];
|
||||
this.viewport = options.viewport;
|
||||
this.textDivs = [];
|
||||
this.findController = options.findController || null;
|
||||
}
|
||||
|
||||
TextLayerBuilder.prototype = {
|
||||
_finishRendering: function TextLayerBuilder_finishRendering() {
|
||||
this.renderingDone = true;
|
||||
|
||||
var event = document.createEvent('CustomEvent');
|
||||
event.initCustomEvent('textlayerrendered', true, true, {
|
||||
pageNumber: this.pageNumber
|
||||
});
|
||||
this.textLayerDiv.dispatchEvent(event);
|
||||
},
|
||||
|
||||
renderLayer: function TextLayerBuilder_renderLayer() {
|
||||
var textLayerFrag = document.createDocumentFragment();
|
||||
var textDivs = this.textDivs;
|
||||
var textDivsLength = textDivs.length;
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
// No point in rendering many divs as it would make the browser
|
||||
// unusable even after the divs are rendered.
|
||||
if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {
|
||||
this._finishRendering();
|
||||
return;
|
||||
}
|
||||
|
||||
var lastFontSize;
|
||||
var lastFontFamily;
|
||||
for (var i = 0; i < textDivsLength; i++) {
|
||||
var textDiv = textDivs[i];
|
||||
if (textDiv.dataset.isWhitespace !== undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var fontSize = textDiv.style.fontSize;
|
||||
var fontFamily = textDiv.style.fontFamily;
|
||||
|
||||
// Only build font string and set to context if different from last.
|
||||
if (fontSize !== lastFontSize || fontFamily !== lastFontFamily) {
|
||||
ctx.font = fontSize + ' ' + fontFamily;
|
||||
lastFontSize = fontSize;
|
||||
lastFontFamily = fontFamily;
|
||||
}
|
||||
|
||||
var width = ctx.measureText(textDiv.textContent).width;
|
||||
if (width > 0) {
|
||||
textLayerFrag.appendChild(textDiv);
|
||||
var transform;
|
||||
if (textDiv.dataset.canvasWidth !== undefined) {
|
||||
// Dataset values come of type string.
|
||||
var textScale = textDiv.dataset.canvasWidth / width;
|
||||
transform = 'scaleX(' + textScale + ')';
|
||||
} else {
|
||||
transform = '';
|
||||
}
|
||||
var rotation = textDiv.dataset.angle;
|
||||
if (rotation) {
|
||||
transform = 'rotate(' + rotation + 'deg) ' + transform;
|
||||
}
|
||||
if (transform) {
|
||||
CustomStyle.setProp('transform' , textDiv, transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.textLayerDiv.appendChild(textLayerFrag);
|
||||
this._finishRendering();
|
||||
this.updateMatches();
|
||||
},
|
||||
|
||||
/**
|
||||
* Renders the text layer.
|
||||
* @param {number} timeout (optional) if specified, the rendering waits
|
||||
* for specified amount of ms.
|
||||
*/
|
||||
render: function TextLayerBuilder_render(timeout) {
|
||||
if (!this.divContentDone || this.renderingDone) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.renderTimer) {
|
||||
clearTimeout(this.renderTimer);
|
||||
this.renderTimer = null;
|
||||
}
|
||||
|
||||
if (!timeout) { // Render right away
|
||||
this.renderLayer();
|
||||
} else { // Schedule
|
||||
var self = this;
|
||||
this.renderTimer = setTimeout(function() {
|
||||
self.renderLayer();
|
||||
self.renderTimer = null;
|
||||
}, timeout);
|
||||
}
|
||||
},
|
||||
|
||||
appendText: function TextLayerBuilder_appendText(geom, styles) {
|
||||
var style = styles[geom.fontName];
|
||||
var textDiv = document.createElement('div');
|
||||
this.textDivs.push(textDiv);
|
||||
if (isAllWhitespace(geom.str)) {
|
||||
textDiv.dataset.isWhitespace = true;
|
||||
return;
|
||||
}
|
||||
var tx = PDFJS.Util.transform(this.viewport.transform, geom.transform);
|
||||
var angle = Math.atan2(tx[1], tx[0]);
|
||||
if (style.vertical) {
|
||||
angle += Math.PI / 2;
|
||||
}
|
||||
var fontHeight = Math.sqrt((tx[2] * tx[2]) + (tx[3] * tx[3]));
|
||||
var fontAscent = fontHeight;
|
||||
if (style.ascent) {
|
||||
fontAscent = style.ascent * fontAscent;
|
||||
} else if (style.descent) {
|
||||
fontAscent = (1 + style.descent) * fontAscent;
|
||||
}
|
||||
|
||||
var left;
|
||||
var top;
|
||||
if (angle === 0) {
|
||||
left = tx[4];
|
||||
top = tx[5] - fontAscent;
|
||||
} else {
|
||||
left = tx[4] + (fontAscent * Math.sin(angle));
|
||||
top = tx[5] - (fontAscent * Math.cos(angle));
|
||||
}
|
||||
textDiv.style.left = left + 'px';
|
||||
textDiv.style.top = top + 'px';
|
||||
textDiv.style.fontSize = fontHeight + 'px';
|
||||
textDiv.style.fontFamily = style.fontFamily;
|
||||
|
||||
textDiv.textContent = geom.str;
|
||||
// |fontName| is only used by the Font Inspector. This test will succeed
|
||||
// when e.g. the Font Inspector is off but the Stepper is on, but it's
|
||||
// not worth the effort to do a more accurate test.
|
||||
if (PDFJS.pdfBug) {
|
||||
textDiv.dataset.fontName = geom.fontName;
|
||||
}
|
||||
// Storing into dataset will convert number into string.
|
||||
if (angle !== 0) {
|
||||
textDiv.dataset.angle = angle * (180 / Math.PI);
|
||||
}
|
||||
// We don't bother scaling single-char text divs, because it has very
|
||||
// little effect on text highlighting. This makes scrolling on docs with
|
||||
// lots of such divs a lot faster.
|
||||
if (textDiv.textContent.length > 1) {
|
||||
if (style.vertical) {
|
||||
textDiv.dataset.canvasWidth = geom.height * this.viewport.scale;
|
||||
} else {
|
||||
textDiv.dataset.canvasWidth = geom.width * this.viewport.scale;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setTextContent: function TextLayerBuilder_setTextContent(textContent) {
|
||||
this.textContent = textContent;
|
||||
|
||||
var textItems = textContent.items;
|
||||
for (var i = 0, len = textItems.length; i < len; i++) {
|
||||
this.appendText(textItems[i], textContent.styles);
|
||||
}
|
||||
this.divContentDone = true;
|
||||
},
|
||||
|
||||
convertMatches: function TextLayerBuilder_convertMatches(matches) {
|
||||
var i = 0;
|
||||
var iIndex = 0;
|
||||
var bidiTexts = this.textContent.items;
|
||||
var end = bidiTexts.length - 1;
|
||||
var queryLen = (this.findController === null ?
|
||||
0 : this.findController.state.query.length);
|
||||
var ret = [];
|
||||
|
||||
for (var m = 0, len = matches.length; m < len; m++) {
|
||||
// Calculate the start position.
|
||||
var matchIdx = matches[m];
|
||||
|
||||
// Loop over the divIdxs.
|
||||
while (i !== end && matchIdx >= (iIndex + bidiTexts[i].str.length)) {
|
||||
iIndex += bidiTexts[i].str.length;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i === bidiTexts.length) {
|
||||
console.error('Could not find a matching mapping');
|
||||
}
|
||||
|
||||
var match = {
|
||||
begin: {
|
||||
divIdx: i,
|
||||
offset: matchIdx - iIndex
|
||||
}
|
||||
};
|
||||
|
||||
// Calculate the end position.
|
||||
matchIdx += queryLen;
|
||||
|
||||
// Somewhat the same array as above, but use > instead of >= to get
|
||||
// the end position right.
|
||||
while (i !== end && matchIdx > (iIndex + bidiTexts[i].str.length)) {
|
||||
iIndex += bidiTexts[i].str.length;
|
||||
i++;
|
||||
}
|
||||
|
||||
match.end = {
|
||||
divIdx: i,
|
||||
offset: matchIdx - iIndex
|
||||
};
|
||||
ret.push(match);
|
||||
}
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
renderMatches: function TextLayerBuilder_renderMatches(matches) {
|
||||
// Early exit if there is nothing to render.
|
||||
if (matches.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var bidiTexts = this.textContent.items;
|
||||
var textDivs = this.textDivs;
|
||||
var prevEnd = null;
|
||||
var pageIdx = this.pageIdx;
|
||||
var isSelectedPage = (this.findController === null ?
|
||||
false : (pageIdx === this.findController.selected.pageIdx));
|
||||
var selectedMatchIdx = (this.findController === null ?
|
||||
-1 : this.findController.selected.matchIdx);
|
||||
var highlightAll = (this.findController === null ?
|
||||
false : this.findController.state.highlightAll);
|
||||
var infinity = {
|
||||
divIdx: -1,
|
||||
offset: undefined
|
||||
};
|
||||
|
||||
function beginText(begin, className) {
|
||||
var divIdx = begin.divIdx;
|
||||
textDivs[divIdx].textContent = '';
|
||||
appendTextToDiv(divIdx, 0, begin.offset, className);
|
||||
}
|
||||
|
||||
function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
|
||||
var div = textDivs[divIdx];
|
||||
var content = bidiTexts[divIdx].str.substring(fromOffset, toOffset);
|
||||
var node = document.createTextNode(content);
|
||||
if (className) {
|
||||
var span = document.createElement('span');
|
||||
span.className = className;
|
||||
span.appendChild(node);
|
||||
div.appendChild(span);
|
||||
return;
|
||||
}
|
||||
div.appendChild(node);
|
||||
}
|
||||
|
||||
var i0 = selectedMatchIdx, i1 = i0 + 1;
|
||||
if (highlightAll) {
|
||||
i0 = 0;
|
||||
i1 = matches.length;
|
||||
} else if (!isSelectedPage) {
|
||||
// Not highlighting all and this isn't the selected page, so do nothing.
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = i0; i < i1; i++) {
|
||||
var match = matches[i];
|
||||
var begin = match.begin;
|
||||
var end = match.end;
|
||||
var isSelected = (isSelectedPage && i === selectedMatchIdx);
|
||||
var highlightSuffix = (isSelected ? ' selected' : '');
|
||||
|
||||
if (this.findController) {
|
||||
this.findController.updateMatchPosition(pageIdx, i, textDivs,
|
||||
begin.divIdx, end.divIdx);
|
||||
}
|
||||
|
||||
// Match inside new div.
|
||||
if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
|
||||
// If there was a previous div, then add the text at the end.
|
||||
if (prevEnd !== null) {
|
||||
appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
|
||||
}
|
||||
// Clear the divs and set the content until the starting point.
|
||||
beginText(begin);
|
||||
} else {
|
||||
appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);
|
||||
}
|
||||
|
||||
if (begin.divIdx === end.divIdx) {
|
||||
appendTextToDiv(begin.divIdx, begin.offset, end.offset,
|
||||
'highlight' + highlightSuffix);
|
||||
} else {
|
||||
appendTextToDiv(begin.divIdx, begin.offset, infinity.offset,
|
||||
'highlight begin' + highlightSuffix);
|
||||
for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {
|
||||
textDivs[n0].className = 'highlight middle' + highlightSuffix;
|
||||
}
|
||||
beginText(end, 'highlight end' + highlightSuffix);
|
||||
}
|
||||
prevEnd = end;
|
||||
}
|
||||
|
||||
if (prevEnd) {
|
||||
appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
|
||||
}
|
||||
},
|
||||
|
||||
updateMatches: function TextLayerBuilder_updateMatches() {
|
||||
// Only show matches when all rendering is done.
|
||||
if (!this.renderingDone) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear all matches.
|
||||
var matches = this.matches;
|
||||
var textDivs = this.textDivs;
|
||||
var bidiTexts = this.textContent.items;
|
||||
var clearedUntilDivIdx = -1;
|
||||
|
||||
// Clear all current matches.
|
||||
for (var i = 0, len = matches.length; i < len; i++) {
|
||||
var match = matches[i];
|
||||
var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
|
||||
for (var n = begin, end = match.end.divIdx; n <= end; n++) {
|
||||
var div = textDivs[n];
|
||||
div.textContent = bidiTexts[n].str;
|
||||
div.className = '';
|
||||
}
|
||||
clearedUntilDivIdx = match.end.divIdx + 1;
|
||||
}
|
||||
|
||||
if (this.findController === null || !this.findController.active) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert the matches on the page controller into the match format
|
||||
// used for the textLayer.
|
||||
this.matches = this.convertMatches(this.findController === null ?
|
||||
[] : (this.findController.pageMatches[this.pageIdx] || []));
|
||||
this.renderMatches(this.matches);
|
||||
}
|
||||
};
|
||||
return TextLayerBuilder;
|
||||
})();
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements IPDFTextLayerFactory
|
||||
*/
|
||||
function DefaultTextLayerFactory() {}
|
||||
DefaultTextLayerFactory.prototype = {
|
||||
/**
|
||||
* @param {HTMLDivElement} textLayerDiv
|
||||
* @param {number} pageIndex
|
||||
* @param {PageViewport} viewport
|
||||
* @returns {TextLayerBuilder}
|
||||
*/
|
||||
createTextLayerBuilder: function (textLayerDiv, pageIndex, viewport) {
|
||||
return new TextLayerBuilder({
|
||||
textLayerDiv: textLayerDiv,
|
||||
pageIndex: pageIndex,
|
||||
viewport: viewport
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,394 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var CSS_UNITS = 96.0 / 72.0;
|
||||
var DEFAULT_SCALE = 'auto';
|
||||
var UNKNOWN_SCALE = 0;
|
||||
var MAX_AUTO_SCALE = 1.25;
|
||||
var SCROLLBAR_PADDING = 40;
|
||||
var VERTICAL_PADDING = 5;
|
||||
|
||||
// optimised CSS custom property getter/setter
|
||||
var CustomStyle = (function CustomStyleClosure() {
|
||||
|
||||
// As noted on: http://www.zachstronaut.com/posts/2009/02/17/
|
||||
// animate-css-transforms-firefox-webkit.html
|
||||
// in some versions of IE9 it is critical that ms appear in this list
|
||||
// before Moz
|
||||
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
|
||||
var _cache = {};
|
||||
|
||||
function CustomStyle() {}
|
||||
|
||||
CustomStyle.getProp = function get(propName, element) {
|
||||
// check cache only when no element is given
|
||||
if (arguments.length === 1 && typeof _cache[propName] === 'string') {
|
||||
return _cache[propName];
|
||||
}
|
||||
|
||||
element = element || document.documentElement;
|
||||
var style = element.style, prefixed, uPropName;
|
||||
|
||||
// test standard property first
|
||||
if (typeof style[propName] === 'string') {
|
||||
return (_cache[propName] = propName);
|
||||
}
|
||||
|
||||
// capitalize
|
||||
uPropName = propName.charAt(0).toUpperCase() + propName.slice(1);
|
||||
|
||||
// test vendor specific properties
|
||||
for (var i = 0, l = prefixes.length; i < l; i++) {
|
||||
prefixed = prefixes[i] + uPropName;
|
||||
if (typeof style[prefixed] === 'string') {
|
||||
return (_cache[propName] = prefixed);
|
||||
}
|
||||
}
|
||||
|
||||
//if all fails then set to undefined
|
||||
return (_cache[propName] = 'undefined');
|
||||
};
|
||||
|
||||
CustomStyle.setProp = function set(propName, element, str) {
|
||||
var prop = this.getProp(propName);
|
||||
if (prop !== 'undefined') {
|
||||
element.style[prop] = str;
|
||||
}
|
||||
};
|
||||
|
||||
return CustomStyle;
|
||||
})();
|
||||
|
||||
function getFileName(url) {
|
||||
var anchor = url.indexOf('#');
|
||||
var query = url.indexOf('?');
|
||||
var end = Math.min(
|
||||
anchor > 0 ? anchor : url.length,
|
||||
query > 0 ? query : url.length);
|
||||
return url.substring(url.lastIndexOf('/', end) + 1, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns scale factor for the canvas. It makes sense for the HiDPI displays.
|
||||
* @return {Object} The object with horizontal (sx) and vertical (sy)
|
||||
scales. The scaled property is set to false if scaling is
|
||||
not required, true otherwise.
|
||||
*/
|
||||
function getOutputScale(ctx) {
|
||||
var devicePixelRatio = window.devicePixelRatio || 1;
|
||||
var backingStoreRatio = ctx.webkitBackingStorePixelRatio ||
|
||||
ctx.mozBackingStorePixelRatio ||
|
||||
ctx.msBackingStorePixelRatio ||
|
||||
ctx.oBackingStorePixelRatio ||
|
||||
ctx.backingStorePixelRatio || 1;
|
||||
var pixelRatio = devicePixelRatio / backingStoreRatio;
|
||||
return {
|
||||
sx: pixelRatio,
|
||||
sy: pixelRatio,
|
||||
scaled: pixelRatio !== 1
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls specified element into view of its parent.
|
||||
* element {Object} The element to be visible.
|
||||
* spot {Object} An object with optional top and left properties,
|
||||
* specifying the offset from the top left edge.
|
||||
*/
|
||||
function scrollIntoView(element, spot) {
|
||||
// Assuming offsetParent is available (it's not available when viewer is in
|
||||
// hidden iframe or object). We have to scroll: if the offsetParent is not set
|
||||
// producing the error. See also animationStartedClosure.
|
||||
var parent = element.offsetParent;
|
||||
var offsetY = element.offsetTop + element.clientTop;
|
||||
var offsetX = element.offsetLeft + element.clientLeft;
|
||||
if (!parent) {
|
||||
console.error('offsetParent is not set -- cannot scroll');
|
||||
return;
|
||||
}
|
||||
while (parent.clientHeight === parent.scrollHeight) {
|
||||
if (parent.dataset._scaleY) {
|
||||
offsetY /= parent.dataset._scaleY;
|
||||
offsetX /= parent.dataset._scaleX;
|
||||
}
|
||||
offsetY += parent.offsetTop;
|
||||
offsetX += parent.offsetLeft;
|
||||
parent = parent.offsetParent;
|
||||
if (!parent) {
|
||||
return; // no need to scroll
|
||||
}
|
||||
}
|
||||
if (spot) {
|
||||
if (spot.top !== undefined) {
|
||||
offsetY += spot.top;
|
||||
}
|
||||
if (spot.left !== undefined) {
|
||||
offsetX += spot.left;
|
||||
parent.scrollLeft = offsetX;
|
||||
}
|
||||
}
|
||||
parent.scrollTop = offsetY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to start monitoring the scroll event and converting them into
|
||||
* PDF.js friendly one: with scroll debounce and scroll direction.
|
||||
*/
|
||||
function watchScroll(viewAreaElement, callback) {
|
||||
var debounceScroll = function debounceScroll(evt) {
|
||||
if (rAF) {
|
||||
return;
|
||||
}
|
||||
// schedule an invocation of scroll for next animation frame.
|
||||
rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
|
||||
rAF = null;
|
||||
|
||||
var currentY = viewAreaElement.scrollTop;
|
||||
var lastY = state.lastY;
|
||||
if (currentY !== lastY) {
|
||||
state.down = currentY > lastY;
|
||||
}
|
||||
state.lastY = currentY;
|
||||
callback(state);
|
||||
});
|
||||
};
|
||||
|
||||
var state = {
|
||||
down: true,
|
||||
lastY: viewAreaElement.scrollTop,
|
||||
_eventHandler: debounceScroll
|
||||
};
|
||||
|
||||
var rAF = null;
|
||||
viewAreaElement.addEventListener('scroll', debounceScroll, true);
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use binary search to find the index of the first item in a given array which
|
||||
* passes a given condition. The items are expected to be sorted in the sense
|
||||
* that if the condition is true for one item in the array, then it is also true
|
||||
* for all following items.
|
||||
*
|
||||
* @returns {Number} Index of the first array element to pass the test,
|
||||
* or |items.length| if no such element exists.
|
||||
*/
|
||||
function binarySearchFirstItem(items, condition) {
|
||||
var minIndex = 0;
|
||||
var maxIndex = items.length - 1;
|
||||
|
||||
if (items.length === 0 || !condition(items[maxIndex])) {
|
||||
return items.length;
|
||||
}
|
||||
if (condition(items[minIndex])) {
|
||||
return minIndex;
|
||||
}
|
||||
|
||||
while (minIndex < maxIndex) {
|
||||
var currentIndex = (minIndex + maxIndex) >> 1;
|
||||
var currentItem = items[currentIndex];
|
||||
if (condition(currentItem)) {
|
||||
maxIndex = currentIndex;
|
||||
} else {
|
||||
minIndex = currentIndex + 1;
|
||||
}
|
||||
}
|
||||
return minIndex; /* === maxIndex */
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic helper to find out what elements are visible within a scroll pane.
|
||||
*/
|
||||
function getVisibleElements(scrollEl, views, sortByVisibility) {
|
||||
var top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight;
|
||||
var left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth;
|
||||
|
||||
function isElementBottomBelowViewTop(view) {
|
||||
var element = view.div;
|
||||
var elementBottom =
|
||||
element.offsetTop + element.clientTop + element.clientHeight;
|
||||
return elementBottom > top;
|
||||
}
|
||||
|
||||
var visible = [], view, element;
|
||||
var currentHeight, viewHeight, hiddenHeight, percentHeight;
|
||||
var currentWidth, viewWidth;
|
||||
var firstVisibleElementInd = (views.length === 0) ? 0 :
|
||||
binarySearchFirstItem(views, isElementBottomBelowViewTop);
|
||||
|
||||
for (var i = firstVisibleElementInd, ii = views.length; i < ii; i++) {
|
||||
view = views[i];
|
||||
element = view.div;
|
||||
currentHeight = element.offsetTop + element.clientTop;
|
||||
viewHeight = element.clientHeight;
|
||||
|
||||
if (currentHeight > bottom) {
|
||||
break;
|
||||
}
|
||||
|
||||
currentWidth = element.offsetLeft + element.clientLeft;
|
||||
viewWidth = element.clientWidth;
|
||||
if (currentWidth + viewWidth < left || currentWidth > right) {
|
||||
continue;
|
||||
}
|
||||
hiddenHeight = Math.max(0, top - currentHeight) +
|
||||
Math.max(0, currentHeight + viewHeight - bottom);
|
||||
percentHeight = ((viewHeight - hiddenHeight) * 100 / viewHeight) | 0;
|
||||
|
||||
visible.push({
|
||||
id: view.id,
|
||||
x: currentWidth,
|
||||
y: currentHeight,
|
||||
view: view,
|
||||
percent: percentHeight
|
||||
});
|
||||
}
|
||||
|
||||
var first = visible[0];
|
||||
var last = visible[visible.length - 1];
|
||||
|
||||
if (sortByVisibility) {
|
||||
visible.sort(function(a, b) {
|
||||
var pc = a.percent - b.percent;
|
||||
if (Math.abs(pc) > 0.001) {
|
||||
return -pc;
|
||||
}
|
||||
return a.id - b.id; // ensure stability
|
||||
});
|
||||
}
|
||||
return {first: first, last: last, views: visible};
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler to suppress context menu.
|
||||
*/
|
||||
function noContextMenuHandler(e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filename or guessed filename from the url (see issue 3455).
|
||||
* url {String} The original PDF location.
|
||||
* @return {String} Guessed PDF file name.
|
||||
*/
|
||||
function getPDFFileNameFromURL(url) {
|
||||
var reURI = /^(?:([^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
|
||||
// SCHEME HOST 1.PATH 2.QUERY 3.REF
|
||||
// Pattern to get last matching NAME.pdf
|
||||
var reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
|
||||
var splitURI = reURI.exec(url);
|
||||
var suggestedFilename = reFilename.exec(splitURI[1]) ||
|
||||
reFilename.exec(splitURI[2]) ||
|
||||
reFilename.exec(splitURI[3]);
|
||||
if (suggestedFilename) {
|
||||
suggestedFilename = suggestedFilename[0];
|
||||
if (suggestedFilename.indexOf('%') !== -1) {
|
||||
// URL-encoded %2Fpath%2Fto%2Ffile.pdf should be file.pdf
|
||||
try {
|
||||
suggestedFilename =
|
||||
reFilename.exec(decodeURIComponent(suggestedFilename))[0];
|
||||
} catch(e) { // Possible (extremely rare) errors:
|
||||
// URIError "Malformed URI", e.g. for "%AA.pdf"
|
||||
// TypeError "null has no properties", e.g. for "%2F.pdf"
|
||||
}
|
||||
}
|
||||
}
|
||||
return suggestedFilename || 'document.pdf';
|
||||
}
|
||||
|
||||
var ProgressBar = (function ProgressBarClosure() {
|
||||
|
||||
function clamp(v, min, max) {
|
||||
return Math.min(Math.max(v, min), max);
|
||||
}
|
||||
|
||||
function ProgressBar(id, opts) {
|
||||
this.visible = true;
|
||||
|
||||
// Fetch the sub-elements for later.
|
||||
this.div = document.querySelector(id + ' .progress');
|
||||
|
||||
// Get the loading bar element, so it can be resized to fit the viewer.
|
||||
this.bar = this.div.parentNode;
|
||||
|
||||
// Get options, with sensible defaults.
|
||||
this.height = opts.height || 100;
|
||||
this.width = opts.width || 100;
|
||||
this.units = opts.units || '%';
|
||||
|
||||
// Initialize heights.
|
||||
this.div.style.height = this.height + this.units;
|
||||
this.percent = 0;
|
||||
}
|
||||
|
||||
ProgressBar.prototype = {
|
||||
|
||||
updateBar: function ProgressBar_updateBar() {
|
||||
if (this._indeterminate) {
|
||||
this.div.classList.add('indeterminate');
|
||||
this.div.style.width = this.width + this.units;
|
||||
return;
|
||||
}
|
||||
|
||||
this.div.classList.remove('indeterminate');
|
||||
var progressSize = this.width * this._percent / 100;
|
||||
this.div.style.width = progressSize + this.units;
|
||||
},
|
||||
|
||||
get percent() {
|
||||
return this._percent;
|
||||
},
|
||||
|
||||
set percent(val) {
|
||||
this._indeterminate = isNaN(val);
|
||||
this._percent = clamp(val, 0, 100);
|
||||
this.updateBar();
|
||||
},
|
||||
|
||||
setWidth: function ProgressBar_setWidth(viewer) {
|
||||
if (viewer) {
|
||||
var container = viewer.parentNode;
|
||||
var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
|
||||
if (scrollbarWidth > 0) {
|
||||
this.bar.setAttribute('style', 'width: calc(100% - ' +
|
||||
scrollbarWidth + 'px);');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hide: function ProgressBar_hide() {
|
||||
if (!this.visible) {
|
||||
return;
|
||||
}
|
||||
this.visible = false;
|
||||
this.bar.classList.add('hidden');
|
||||
document.body.classList.remove('loadingInProgress');
|
||||
},
|
||||
|
||||
show: function ProgressBar_show() {
|
||||
if (this.visible) {
|
||||
return;
|
||||
}
|
||||
this.visible = true;
|
||||
document.body.classList.add('loadingInProgress');
|
||||
this.bar.classList.remove('hidden');
|
||||
}
|
||||
};
|
||||
|
||||
return ProgressBar;
|
||||
})();
|
||||
|
Before Width: | Height: | Size: 100 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,223 +0,0 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# rebrandly
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['rebrandly']['information'] = array(
|
||||
# The casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'Rebrandly for Kleeja',
|
||||
'ar' => 'Rebrandly لكليجا'
|
||||
),
|
||||
# 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' => 'Generate a short links using Rebrandly service',
|
||||
'ar' => 'إنشاء روابط قصيرة من خدمة Rebrandly '
|
||||
),
|
||||
# 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.9',
|
||||
# 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['rebrandly']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك إضافة rebrandly ، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
<hr>
|
||||
<br>
|
||||
<h3>لاحظ:</h3>
|
||||
<b>تجد إعدادات الإضافة في : إعدادات المركز->خيارات Rebrandly</b>
|
||||
<br>
|
||||
<br>
|
||||
-------
|
||||
<h3>معلومات قد تفيدك: </h3>
|
||||
- <a href='https://www.rebrandly.com'>إضغط هنا للتسجيل في Rebrandly</a> <br>
|
||||
";
|
||||
|
||||
$kleeja_plugin['rebrandly']['first_run']['en'] = "
|
||||
Thanks for using rebrandly plugin, to report bugs contact us:
|
||||
<br>
|
||||
info@kleeja.com
|
||||
<hr>
|
||||
<br>
|
||||
<h3>Note:</h3>
|
||||
<b>You can find the settings at: Settings -> Rebrandly Settings</b>
|
||||
<br>
|
||||
<br>
|
||||
-------
|
||||
<h3>Extra Info: </h3>
|
||||
- <a href='https://www.rebrandly.com' target='_blank'>Create your rebrandly account now!</a> <br>
|
||||
";
|
||||
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['rebrandly']['install'] = function ($plg_id) {
|
||||
//new options
|
||||
$options = array(
|
||||
'rebrandly_enable' =>
|
||||
array(
|
||||
'value' => '0',
|
||||
'html' => configField('rebrandly_enable', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'rebrandly'
|
||||
),
|
||||
'rebrandly_domain' =>
|
||||
array(
|
||||
'value' => 'rebrand.ly',
|
||||
'html' => configField('rebrandly_domain'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'rebrandly'
|
||||
),
|
||||
'rebrandly_api_code' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('rebrandly_api_code'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'rebrandly'
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'REBRANDLY_ENABLE' => 'تفعيل Rebrandly',
|
||||
'REBRANDLY_API_CODE' => 'كود الربط API لـ Rebrandly',
|
||||
'REBRANDLY_DOMAIN' => 'الدومين المستخدم',
|
||||
'CONFIG_KLJ_MENUS_REBRANDLY' => 'خيارات Rebrandly',
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'REBRANDLY_ENABLE' => 'Enable Rebrandly',
|
||||
'REBRANDLY_API_CODE' => 'Your API code of Rebrandly',
|
||||
'REBRANDLY_DOMAIN' => 'Domain of Rebrandly',
|
||||
'CONFIG_KLJ_MENUS_REBRANDLY' => 'Rebrandly Settings',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//Plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['rebrandly']['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['rebrandly']['uninstall'] = function ($plg_id) {
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'rebrandly_enable',
|
||||
'rebrandly_api_code',
|
||||
'rebrandly_domain'
|
||||
));
|
||||
|
||||
//delete language variables
|
||||
foreach (array('ar', 'en') as $language) {
|
||||
delete_olang(null, $language, $plg_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['rebrandly']['functions'] = array(
|
||||
'kleeja_get_link_func2' => function ($args) {
|
||||
global $config;
|
||||
|
||||
if (!$config['rebrandly_enable']) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(defined('IN_REAL_INDEX'))
|
||||
{
|
||||
$link = $args['return_link'];
|
||||
$current_pid = $args['pid'];
|
||||
if($current_pid === 'file') {
|
||||
|
||||
$return_link = generate_rebrandly_link($link);
|
||||
|
||||
return compact('return_link');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* special functions
|
||||
*/
|
||||
|
||||
if (!function_exists('genera_rebrandly_link')) {
|
||||
function generate_rebrandly_link($link)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
||||
if (!$config['rebrandly_enable']) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
if (empty($config['rebrandly_api_code'])) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
if (empty($config['rebrandly_domain'])) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
$post_data["destination"] = $link;
|
||||
$post_data["domain"] = array('fullName' => $config['rebrandly_domain']);;
|
||||
|
||||
$ch = curl_init("https://api.rebrandly.com/v1/links");
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
"apikey: " . $config['rebrandly_api_code'],
|
||||
"Content-Type: application/json"
|
||||
));
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$response = json_decode($result, true);
|
||||
|
||||
if(!empty($response["shortUrl"])){
|
||||
return $response["shortUrl"];
|
||||
}
|
||||
|
||||
|
||||
return $link;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 116 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,231 +0,0 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# traidnt_arbah
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['traidnt_arbah']['information'] = array(
|
||||
# The casual name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'Traidnt Arbah',
|
||||
'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' => 'Generate a links using Traidnt Arbah service',
|
||||
'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.9',
|
||||
# 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['traidnt_arbah']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك إضافة ترايدنت أرباح، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
<hr>
|
||||
<br>
|
||||
<h3>لاحظ:</h3>
|
||||
<b>تجد إعدادات الإضافة في : إعدادات المركز->خيارات ترايدنت أرباح</b>
|
||||
<br>
|
||||
<br>
|
||||
-------
|
||||
<h3>معلومات قد تفيدك في برنامج أرباح: </h3>
|
||||
|
||||
- <a href='http://www.traidnt.net/link/index.html?referral=84289' target='_blank'>صفحة أرباح الأساسية - سجل وضعها في المفضلة</a> <br>
|
||||
- <a href='http://www.traidnt.net/link/rules.html?referral=84289' target='_blank'>شروط وقوانين برنامج أرباح</a> <br>
|
||||
- <a href='http://www.traidnt.net/page-3.html?title=adsense&referral=84289' target='_blank'>معلومات مهمة عن أدسنس والمشاكل وحلولها مع أرباح</a>
|
||||
|
||||
";
|
||||
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['traidnt_arbah']['install'] = function ($plg_id) {
|
||||
//new options
|
||||
$options = array(
|
||||
'traidnt_arbah_enable' =>
|
||||
array(
|
||||
'value' => '0',
|
||||
'html' => configField('traidnt_arbah_enable', 'yesno'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'traidnt_arbah'
|
||||
),
|
||||
'traidnt_arbah_api_code' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('traidnt_arbah_api_code'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'traidnt_arbah'
|
||||
),
|
||||
'traidnt_arbah_user_id' =>
|
||||
array(
|
||||
'value' => '',
|
||||
'html' => configField('traidnt_arbah_user_id'),
|
||||
'plg_id' => $plg_id,
|
||||
'type' => 'traidnt_arbah'
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
add_config_r($options);
|
||||
|
||||
|
||||
//new language variables
|
||||
add_olang(array(
|
||||
'TRAIDNT_ARBAH_ENABLE' => 'تفعيل ترايدنت أرباح',
|
||||
'TRAIDNT_ARBAH_API_CODE' => 'كود الربط لترايدنت أرباح (تجده في حسابك في أرباح)',
|
||||
'TRAIDNT_ARBAH_USER_ID' => 'رقم عضويتك لترايدنت أرباح (للربط السريع)',
|
||||
'CONFIG_KLJ_MENUS_TRAIDNT_ARBAH' => 'خيارات ترايدنت أرباح',
|
||||
),
|
||||
'ar',
|
||||
$plg_id);
|
||||
|
||||
add_olang(array(
|
||||
'TRAIDNT_ARBAH_ENABLE' => 'Enable Traidnt Arbah',
|
||||
'TRAIDNT_ARBAH_API_CODE' => 'Your API code of Traidnt Arbah',
|
||||
'TRAIDNT_ARBAH_USER_ID' => 'Your user ID of Traidnt Arbah',
|
||||
'CONFIG_KLJ_MENUS_TRAIDNT_ARBAH' => 'Traidnt Arbah Settings',
|
||||
),
|
||||
'en',
|
||||
$plg_id);
|
||||
};
|
||||
|
||||
|
||||
//Plugin update function, called if plugin is already installed but version is different than current
|
||||
$kleeja_plugin['traidnt_arbah']['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['traidnt_arbah']['uninstall'] = function ($plg_id) {
|
||||
//delete options
|
||||
delete_config(array(
|
||||
'traidnt_arbah_enable',
|
||||
'traidnt_arbah_api_code',
|
||||
'traidnt_arbah_user_id'
|
||||
));
|
||||
|
||||
//delete language variables
|
||||
foreach (array('ar', 'en') as $language) {
|
||||
delete_olang(null, $language, $plg_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['traidnt_arbah']['functions'] = array(
|
||||
|
||||
'default_go_page' => function($args){
|
||||
if(g('go') == 'arbah')
|
||||
{
|
||||
$url = g('url', 'str');
|
||||
$no_request = false;
|
||||
header('Location:' . generate_traidnt_arbah_link(base64_decode($url)));
|
||||
return compact('no_request');
|
||||
}
|
||||
},
|
||||
|
||||
'kleeja_get_link_func2' => function ($args) {
|
||||
global $config;
|
||||
|
||||
if (!$config['traidnt_arbah_enable']) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(defined('IN_REAL_INDEX'))
|
||||
{
|
||||
$return_link = $args['return_link'];
|
||||
$current_pid = $args['pid'];
|
||||
if($current_pid === 'file') {
|
||||
$return_link = $config['siteurl'] . 'go.php?go=arbah&url=' . base64_encode($return_link);
|
||||
return compact('return_link');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* special functions
|
||||
*/
|
||||
|
||||
if (!function_exists('generate_traidnt_arbah_link')) {
|
||||
function generate_traidnt_arbah_link($link, $by_user_id = false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
||||
if (!$config['traidnt_arbah_enable']) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
if (empty($config['traidnt_arbah_api_code'])) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
if($by_user_id)
|
||||
{
|
||||
if (empty($config['traidnt_arbah_user_id'])) {
|
||||
return $link;
|
||||
}else{
|
||||
$config['traidnt_arbah_user_id'] = preg_replace('/[^0-9]/', '', $config['traidnt_arbah_user_id']);
|
||||
return 'https://traidnt.net/link/fast_link.html?user=' . trim(intval($config['traidnt_arbah_user_id']))
|
||||
. '&url=' . trim($link);
|
||||
}
|
||||
}
|
||||
|
||||
$service_url = "https://www.traidnt.net/link/api.html?url=".trim($link)
|
||||
. "&api=".trim($config['traidnt_arbah_api_code'])
|
||||
. "&allow_adv=1"
|
||||
. "&minipage=1";
|
||||
|
||||
|
||||
$received_data = fetch_remote_file($service_url);
|
||||
|
||||
|
||||
if(empty($received_data))
|
||||
{
|
||||
return $by_user_id ? $link : generate_traidnt_arbah_link($link, true);
|
||||
}
|
||||
|
||||
|
||||
$decoded_data = json_decode($received_data);
|
||||
|
||||
if($decoded_data->error or $decoded_data->code == '')
|
||||
{
|
||||
return $by_user_id ? $link : generate_traidnt_arbah_link($link, true);
|
||||
}
|
||||
|
||||
if(!empty($decoded_data->url))
|
||||
{
|
||||
return $decoded_data->url;
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 7.4 KiB |
@@ -1,55 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,200 +0,0 @@
|
||||
<?php
|
||||
# Kleeja Plugin
|
||||
# video_player
|
||||
# Version: 1.0
|
||||
# Developer: Kleeja team
|
||||
|
||||
# Prevent illegal run
|
||||
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
# Plugin Basic Information
|
||||
$kleeja_plugin['video_player']['information'] = array(
|
||||
# The casucal name of this plugin, anything can a human being understands
|
||||
'plugin_title' => array(
|
||||
'en' => 'Video & Audio Player',
|
||||
'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' => 'Integrate a video player in download 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.9',
|
||||
# Should this plugin run before others?, 0 is normal, and higher number has high priority
|
||||
'plugin_priority' => 10
|
||||
);
|
||||
|
||||
//after installation message, you can remove it, it's not required
|
||||
$kleeja_plugin['video_player']['first_run']['ar'] = "
|
||||
شكراً لاستخدامك هذه الإضافة قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
$kleeja_plugin['video_player']['first_run']['en'] = "
|
||||
Thanks for using this plugin, to report bugs contact us:
|
||||
<br>
|
||||
info@kleeja.com
|
||||
";
|
||||
|
||||
|
||||
# Plugin Installation function
|
||||
$kleeja_plugin['video_player']['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['video_player']['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['video_player']['uninstall'] = function ($plg_id) {
|
||||
//delete language variables
|
||||
// foreach (array('ar', 'en') as $language) {
|
||||
// delete_olang(null, $language, $plg_id);
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
# Plugin functions
|
||||
$kleeja_plugin['video_player']['functions'] = array(
|
||||
|
||||
'Saaheader_links_func' => function($args){
|
||||
|
||||
$extra = $args['extra'];
|
||||
|
||||
$header_codes = '<link href="//vjs.zencdn.net/6.2.7/video-js.css" rel="stylesheet">' . "\n" .
|
||||
'<script src="//vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>' . "\n";
|
||||
|
||||
|
||||
$extra .= $header_codes;
|
||||
|
||||
return compact('extra');
|
||||
},
|
||||
|
||||
'print_Saafooter_func' => function($args){
|
||||
$footer = $args['footer'];
|
||||
|
||||
$footer = str_replace('</body>', "<script src=\"//vjs.zencdn.net/6.2.7/video.js\"></script>\n</body>", $footer);
|
||||
return compact('footer');
|
||||
},
|
||||
|
||||
'style_parse_func' => function($args) {
|
||||
global $config;
|
||||
|
||||
|
||||
if($args['template_name'] == 'download') {
|
||||
|
||||
$x = PHP_EOL . '<IF NAME="show_video_player_code">
|
||||
<div style="clear: both;"></div>
|
||||
<div class="videoplayerbox" style="margin-top: 20px">
|
||||
<video id="my-video" class="video-js vjs-16-9" controls preload="auto" width="640" height="264"
|
||||
data-setup="{}" style="margin: 0 auto;">
|
||||
<source src="{video_path}#t=0.1" type=\'{video_mime_type}\'>
|
||||
<p class="vjs-no-js">
|
||||
To view this video please enable JavaScript, and consider upgrading to a web browser that
|
||||
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
|
||||
</p>
|
||||
</video>
|
||||
</div>
|
||||
</IF>';
|
||||
|
||||
$x .= PHP_EOL . '<IF NAME="show_audio_player_code">
|
||||
<div style="clear: both;"></div>
|
||||
<div class="videoplayerbox audiobox" style="margin-top: 20px">
|
||||
<audio id="my-video" class="video-js vjs-16-9" controls preload="auto" width="640" height="264"
|
||||
data-setup="{}" style="margin: 0 auto;">
|
||||
<source src="{video_path}#t=0.1" type=\'{video_mime_type}\'>
|
||||
<p class="vjs-no-js">
|
||||
To listen to this audio please enable JavaScript, and consider upgrading to a web browser that
|
||||
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
|
||||
</p>
|
||||
</audio>
|
||||
</div>
|
||||
</IF>';
|
||||
|
||||
$html = $args['html'] . $x;
|
||||
|
||||
return compact('html');
|
||||
}
|
||||
},
|
||||
|
||||
'b4_showsty_downlaod_id_filename' => function($args){
|
||||
|
||||
|
||||
$file_info = $args['file_info'];
|
||||
|
||||
|
||||
$show_video_player_code = false;
|
||||
$show_audio_player_code = false;
|
||||
$video_path = '';
|
||||
$video_thumb = '';
|
||||
$video_mime_type = '';
|
||||
|
||||
$type_mimes = array(
|
||||
'mp4' => 'video/mp4',
|
||||
'webm' => 'video/webm',
|
||||
// 'webma' => 'audio/webm',
|
||||
'ogg' => 'video/ogg',
|
||||
'ogv' => 'video/ogg',
|
||||
'3gp' => 'video/3gp',
|
||||
'flv' => 'video/x-flv',
|
||||
'oga' => 'audio/ogg',
|
||||
'mp3' => 'audio/mp3',
|
||||
'wav' => 'audio/wav',
|
||||
'flac' => 'audio/flac',
|
||||
);
|
||||
|
||||
if(in_array(strtolower($file_info['type']), array_keys($type_mimes))){
|
||||
|
||||
if(in_array(strtolower($file_info['type']), array('mp3', 'oga', 'wav', 'flac'))){
|
||||
$show_audio_player_code = true;
|
||||
}else{
|
||||
$show_video_player_code = true;
|
||||
}
|
||||
|
||||
|
||||
$video_path = "./{$file_info['folder']}/{$file_info['name']}";
|
||||
|
||||
$video_mime_type = $type_mimes[$file_info['type']];
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('plugin:video_player:do_display', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
}
|
||||
|
||||
return compact('show_video_player_code', 'video_path', 'video_thumb', 'video_mime_type', 'show_audio_player_code');
|
||||
}
|
||||
);
|
||||
|
||||