first commit

This commit is contained in:
2024-12-12 15:33:18 +01:00
commit 2c8998663e
3360 changed files with 777573 additions and 0 deletions

0
.gitignore vendored Normal file
View File

11
.htaccess Normal file
View File

@@ -0,0 +1,11 @@
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^rank24.pl
RewriteRule ^(.*)$ http://www.rank24.pl/$1 [R=permanent,L]
ErrorDocument 404 http://www.rank24.pl
RewriteCond %{REQUEST_URI} !^(.*)/libraries/(.*) [NC]
RewriteCond %{REQUEST_URI} !^(.*)/layout/(.*) [NC]
RewriteRule ^([^/]*)/([^/]*)/(.*)$ index.php?module=$1&action=$2&$3 [L]

17
.vscode/ftp-kr.json vendored Normal file
View File

@@ -0,0 +1,17 @@
{
"host": "dapro25624.serwervps.pl",
"username": "www@rank24.pl",
"password": "WLZtVXv9Vr9xKfpgHxKC",
"remotePath": "/public_html/",
"protocol": "ftp",
"port": 0,
"fileNameEncoding": "utf8",
"autoUpload": true,
"autoDelete": false,
"autoDownload": false,
"ignoreRemoteModification": true,
"ignore": [
".git",
"/.vscode"
]
}

105
.vscode/ftp-kr.sync.cache.json vendored Normal file
View File

@@ -0,0 +1,105 @@
{
"ftp://server.hostline.pl@www@rank24.pl": {
"public_html": {
"ajax-check.php": {
"type": "-",
"size": 1780,
"lmtime": 0,
"modified": false
},
"ajax.php": {
"type": "-",
"size": 8865,
"lmtime": 0,
"modified": false
},
"api.php": {
"type": "-",
"size": 6206,
"lmtime": 0,
"modified": false
},
"autoload": {},
"config.php": {
"type": "-",
"size": 1656,
"lmtime": 1712864705076,
"modified": false
},
"cron.php": {
"type": "-",
"size": 4246,
"lmtime": 0,
"modified": false
},
"d4s.txt": {
"type": "-",
"size": 0,
"lmtime": 0,
"modified": false
},
"dsf.php": {
"type": "-",
"size": 4799,
"lmtime": 0,
"modified": false
},
"files": {},
"functions": {},
".gitignore": {
"type": "-",
"size": 7,
"lmtime": 0,
"modified": false
},
"google-rank.txt": {
"type": "-",
"size": 592550,
"lmtime": 0,
"modified": false
},
".htaccess": {
"type": "-",
"size": 421,
"lmtime": 0,
"modified": false
},
"index.php": {
"type": "-",
"size": 2530,
"lmtime": 0,
"modified": false
},
"json.php": {
"type": "-",
"size": 5850,
"lmtime": 0,
"modified": false
},
"latest.csv": {
"type": "-",
"size": 7354127,
"lmtime": 0,
"modified": false
},
"layout": {},
"libraries": {},
"monitoring.php": {
"type": "-",
"size": 7874,
"lmtime": 0,
"modified": false
},
"proxy.php": {
"type": "-",
"size": 2,
"lmtime": 0,
"modified": false
},
"resources": {},
"templates": {},
"updates": {}
}
},
"$version": 1
}

12
.vscode/sftp.json vendored Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "dapro25624.serwervps.pl",
"host": "dapro25624.serwervps.pl",
"protocol": "ftp",
"port": 21,
"username": "www@rank24.pl",
"password": "WLZtVXv9Vr9xKfpgHxKC",
"remotePath": "/public_html/",
"uploadOnSave": false,
"useTempFile": false,
"openSsh": false
}

56
ajax-check.php Normal file
View File

@@ -0,0 +1,56 @@
<?
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
function __autoload_my_classes( $classname )
{
$q = explode( '\\' , $classname );
$c = array_pop( $q );
$f = 'autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
if ( $c == 'Savant3' )
{
require_once 'autoload/Savant3.php';
return true;
}
if ( file_exists( $f ) )
require_once( $f );
}
spl_autoload_register( '__autoload_my_classes' );
mb_internal_encoding( "UTF-8" );
define( 'OPD_DIR' , 'autoload/' );
require_once OPD_DIR . 'opd.class.php';
require_once 'config.php';
require_once 'libraries/medoo.php';
require_once 'resources/xajax/xajax_core/xajax.inc.php';
require_once 'libraries/grid/config.php';
date_default_timezone_set('Europe/Warsaw');
function sortByOption( $a, $b ) {
return strcmp( $a['date'], $b['date']);
}
session_start();
$mdb = new medoo( [
'database_type' => 'mysql',
'database_name' => $config['db']['name'],
'server' => $config['db']['host'],
'username' => $config['db']['user'],
'password' => $config['db']['password'],
'charset' => 'utf8'
] );
if ( \S::get( 'a' ) == 'phrase-position' )
{
echo json_encode( [
'position' => $mdb -> get( 'pro_rr_phrases_positions', 'position', [
'AND' => [
'phrase_id' => \S::get( 'phrase_id' ),
'date' => date( 'Y-m-d' )
] ] ),
'last_url' => \factory\Ranker::last_phrase_url( \S::get( 'phrase_id' ) )
] );
exit;
}

176
ajax.php Normal file
View File

@@ -0,0 +1,176 @@
<?
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
function __autoload_my_classes( $classname )
{
$q = explode( '\\' , $classname );
$c = array_pop( $q );
$f = 'autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
if ( $c == 'Savant3' )
{
require_once 'autoload/Savant3.php';
return true;
}
if ( file_exists( $f ) )
require_once( $f );
}
spl_autoload_register( '__autoload_my_classes' );
mb_internal_encoding( "UTF-8" );
define( 'OPD_DIR' , 'autoload/' );
require_once OPD_DIR . 'opd.class.php';
require_once 'config.php';
require_once 'libraries/medoo.php';
require_once 'resources/xajax/xajax_core/xajax.inc.php';
require_once 'libraries/grid/config.php';
date_default_timezone_set('Europe/Warsaw');
function sortByOption( $a, $b ) {
return strcmp( $a['date'], $b['date']);
}
session_start();
$db = opdClass::create(
array(
'dsn' => 'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['name'],
'user' => $config['db']['user'] ,
'password' => $config['db']['password'] ,
'cache' => 'temp/' ,
'debugConsole' => $config['db']['debug']
)
);
$db -> query( 'SET NAMES utf8' );
$mdb = new medoo( [
'database_type' => 'mysql',
'database_name' => $config['db']['name'],
'server' => $config['db']['host'],
'username' => $config['db']['user'],
'password' => $config['db']['password'],
'charset' => 'utf8'
] );
/* usunięcie komentarza do strony */
if ( \S::get( 'a' ) == 'comment_delete' )
{
$result = \factory\Ranker::delete_site_comment_info( \S::get( 'site_id' ), \S::get( 'date' ) );
echo json_encode( [ 'status' => 'ok' ] );
exit;
}
/* zapisanie komentarza z danego dnia */
if ( \S::get( 'a' ) == 'comment_save' )
{
$result = \factory\Ranker::change_site_comment_info( \S::get( 'site_id' ), \S::get( 'date' ), \S::get( 'comment' ) );
echo json_encode( [ 'status' => 'ok' ] );
exit;
}
/* pobranie komentarza z danego dnia */
if ( \S::get( 'a' ) == 'comment_details' )
{
echo $mdb -> get( 'pro_rr_sites_comments', 'comment', [ 'AND' => [ 'site_id' => \S::get( 'site_id' ), 'date' => \S::get( 'date' ) ] ] );
exit;
}
/* potiwerdzenie wyników strony */
if ( \S::get( 'a' ) == 'site_confirm' )
{
$result = \factory\Ranker::site_confirm( \S::get( 'site_id' ) );
echo json_encode( [ 'status' => 'ok' ] );
exit;
}
/* odświeżenie pozycji */
if ( \S::get( 'a' ) == 'refresh_phrase_position' )
{
$mdb -> delete( 'phrase_positions_statistic', [
'AND' => [
'phrase_id' => \S::get( 'phrase_id' ),
'date' => date( 'Y-m-d' )
]
] );
$mdb -> delete( 'pro_rr_phrases_positions', [
'AND' => [
'phrase_id' => \S::get( 'phrase_id' ),
'date' => date( 'Y-m-d' )
]
] );
$mdb -> update( 'pro_rr_phrases', [
'last_checked' => null,
'ds_date' => null,
'ds_id' => null
], [
'id' => \S::get( 'phrase_id' )
] );
echo json_encode( [ 'status' => 'ok' ] );
exit;
}
/* zmiana pozycji */
if ( \S::get( 'a' ) == 'change_phrase_position' )
{
$mdb -> update( 'phrase_positions_statistic', [
'position' => \S::get( 'position' )
], [
'AND' => [
'phrase_id' => \S::get( 'phrase_id'),
'date' => \S::get( 'date' )
]
] );
if ( $mdb -> count( 'pro_rr_phrases_positions', [
'AND' => [
'phrase_id' => \S::get( 'phrase_id'),
'date' => \S::get( 'date' )
]
] ) )
{
if ( \S::get( 'position' ) != '' )
$mdb -> update( 'pro_rr_phrases_positions', [
'position' => \S::get( 'position' )
], [
'AND' => [
'phrase_id' => \S::get( 'phrase_id'),
'date' => \S::get( 'date' )
]
] );
else
$mdb -> delete( 'pro_rr_phrases_positions', [
'AND' => [
'phrase_id' => \S::get( 'phrase_id'),
'date' => \S::get( 'date' )
]
] );
}
else
{
$mdb -> insert( 'pro_rr_phrases_positions', [
'position' => \S::get( 'position' ),
'phrase_id' => \S::get( 'phrase_id'),
'date' => \S::get( 'date' )
] );
}
echo json_encode( [ 'status' => 'ok' ] );
exit;
}
/* odświeżenie zarobków */
if ( \S::get( 'a' ) == 'refresh-earnings' )
{
\S::deleteCache( 'temp/' );
$month = \S::get_session( 'ranker:main_view:month' );
$year = \S::get_session( 'ranker:main_view:year' );
echo json_encode( [
'status' => 'ok',
'month_profit' => \factory\Ranker::getMonthProfit( $month, $year ),
'day_profit' => \factory\Ranker::day_profit()
] );
exit;
}

162
api.php Normal file
View File

@@ -0,0 +1,162 @@
<?
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
function __autoload_my_classes( $classname )
{
$q = explode( '\\' , $classname );
$c = array_pop( $q );
$f = 'autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
if ( $c == 'Savant3' )
{
require_once 'autoload/Savant3.php';
return true;
}
if ( file_exists( $f ) )
require_once( $f );
}
spl_autoload_register( '__autoload_my_classes' );
mb_internal_encoding( "UTF-8" );
define( 'OPD_DIR' , 'autoload/' );
require_once OPD_DIR . 'opd.class.php';
require_once 'config.php';
require_once 'libraries/medoo.php';
require_once 'libraries/grid/config.php';
require_once 'resources/phpmailer/class.phpmailer.php';
date_default_timezone_set('Europe/Warsaw');
header( 'Content-Type: text/html; charset=utf-8' );
session_start();
$db = opdClass::create(
array(
'dsn' => 'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['name'],
'user' => $config['db']['user'] ,
'password' => $config['db']['password'] ,
'cache' => 'temp/' ,
'debugConsole' => $config['db']['debug']
)
);
$db -> query( 'SET NAMES utf8' );
$mdb = new medoo( [
'database_type' => 'mysql',
'database_name' => $config['db']['name'],
'server' => $config['db']['host'],
'username' => $config['db']['user'],
'password' => $config['db']['password'],
'charset' => 'utf8'
] );
if ( \S::get( 'action' ) == 'majestic_domain_save' )
{
if ( \S::get( 'okazwloka' ) == true )
{
$results = str_replace( 'OK|', '', \S::get( 'result' ) );
$results = json_decode( $results, true );
$results = array_pop( $results );
$feb = $results['feb'];
$tf = $results['tf'];
$cf = $results['cf'];
$rd = $results['frd'];
}
else
{
$results = json_decode( \S::get( 'result' ), true );
$feb = $results['ExtBackLinks'];
$tf = $results['TrustFlow'];
$cf = $results['CitationFlow'];
$rd = $results['RefDomains'];
}
$mdb -> update( 'pro_rr_sites', [ 'majestic_date' => date( 'Y-m-d H:i:s' ) ], [ 'id' => \S::get( 'domain_id' ) ] );
$mdb -> insert( 'pro_rr_sites_majestic', [
'site_id' => \S::get( 'domain_id' ),
'feb' => $feb,
'cf' => $cf,
'tf' => $tf,
'rd' => $rd,
'date' => date( 'Y-m-d' )
] );
echo json_encode( [ 'result' => 'ok' ] );
exit;
}
if ( \S::get( 'action' ) == 'majestic_domain_check' )
{
$results = $mdb -> query( 'SELECT '
. 'id, url '
. 'FROM '
. 'pro_rr_sites '
. 'WHERE '
. '( DATE_ADD( majestic_date, INTERVAL ' . $config['site']['majestic_interval'] . ' DAY ) <= \'' . date( 'Y-m-d' ) . '\' OR majestic_date IS NULL ) '
. 'AND '
. 'majestic = 1 '
. 'ORDER BY '
. 'majestic_date ASC '
. 'LIMIT 1' ) -> fetchAll( \PDO::FETCH_ASSOC );
if ( is_array( $results ) and !empty( $results ) )
{
$results[0]['url'] = str_replace( 'www.', '', $results[0]['url'] );
$results[0]['result'] = 'ok';
echo json_encode( $results[0] );
}
else
echo json_encode( [ 'result' => 'bad' ] );
exit;
}
if ( \S::get( 'action' ) == 'semstorm_domain_save' )
{
$results = json_decode( \S::get( 'result' ), true );
foreach ( $results['results'][\S::get( 'url' )] as $key => $val )
{
if ( $key <= 3 )
$top3 += $val;
if ( $key <= 10 )
$top10 += $val;
if ( $key <= 50 )
$top50 += $val;
}
$mdb -> update( 'pro_rr_sites', [ 'semstorm_date' => date( 'Y-m-d H:i:s' ) ], [ 'id' => \S::get( 'domain_id' ) ] );
$mdb -> insert( 'pro_rr_sites_semstorm', [
'site_id' => \S::get( 'domain_id' ),
'top3' => (int)$top3,
'top10' => (int)$top10,
'top50' => (int)$top50,
'date' => date( 'Y-m-d' )
] );
echo json_encode( [ 'result' => 'ok' ] );
exit;
}
if ( \S::get( 'action' ) == 'semstorm_domain_check' )
{
$results = $mdb -> query( 'SELECT '
. 'id, url '
. 'FROM '
. 'pro_rr_sites '
. 'WHERE '
. '( DATE_ADD( semstorm_date, INTERVAL ' . $config['site']['semstorm_interval'] . ' DAY ) <= \'' . date( 'Y-m-d' ) . '\' OR semstorm_date IS NULL ) '
. 'AND '
. 'semstorm = 1 '
. 'ORDER BY '
. 'semstorm_date ASC '
. 'LIMIT 1' ) -> fetchAll( \PDO::FETCH_ASSOC );
if ( is_array( $results ) and !empty( $results ) )
{
$results[0]['url'] = str_replace( 'www.', '', $results[0]['url'] );
$results[0]['result'] = 'ok';
echo json_encode( $results[0] );
}
else
echo json_encode( [ 'result' => 'bad' ] );
exit;
}
echo json_encode( [ 'result' => 'bad' ] );

295
autoload/RestClient.php Normal file
View File

@@ -0,0 +1,295 @@
<?php
if (!function_exists('http_parse_headers')) {
function http_parse_headers($raw_headers)
{
$headers = array();
$key = ''; // [+]
foreach(explode("\n", $raw_headers) as $i => $h)
{
$h = explode(':', $h, 2);
if (isset($h[1]))
{
if (!isset($headers[$h[0]]))
$headers[$h[0]] = trim($h[1]);
elseif (is_array($headers[$h[0]]))
{
// $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); // [-]
// $headers[$h[0]] = $tmp; // [-]
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); // [+]
}
else
{
// $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [-]
// $headers[$h[0]] = $tmp; // [-]
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [+]
}
$key = $h[0]; // [+]
}
else // [+]
{ // [+]
if (substr($h[0], 0, 1) == "\t") // [+]
$headers[$key] .= "\r\n\t".trim($h[0]); // [+]
elseif (!$key) // [+]
$headers[0] = trim($h[0]); // [+]
} // [+]
}
return $headers;
}
}
/**
* PHP REST Client build with cURL
*
* @author Fabio Agostinho Boris <fabioboris@gmail.com>
*/
class RestClient
{
public $host; // the url to the rest server
public $port;
public $post_type = 'json';
public $timeout = 60;
private $token; // Auth token
private $ba_user;
private $ba_password;
public $last_url = '';
public $user_agent = '';
public function __construct($host, $token = null, $ba_user = null, $ba_password = null, $user_agent = null)
{
$arr_h = parse_url($host);
if (isset($arr_h['port'])) {
$this->port = (int)$arr_h['port'];
$this->host = str_replace(":".$this->port, "", $host);
} else {
$this->port = null;
$this->host = $host;
}
$this->token = $token;
$this->ba_user = $ba_user;
$this->ba_password = $ba_password;
$this->user_agent = $user_agent;
}
/**
* Returns the absolute URL
*
* @param string $url
*/
private function url($url = null)
{
$_host = rtrim($this->host, '/');
$_url = ltrim($url, '/');
return isset($this->port) ? "{$_host}:{$this->port}/{$_url}" : "{$_host}/{$_url}";
}
/**
* Returns the URL with encoded query string params
*
* @param string $url
* @param array $params
*/
private function urlQueryString($url, $params = null)
{
$qs = array();
if ($params) {
foreach ($params as $key => $value) {
$qs[] = "{$key}=" . urlencode($value);
}
}
$url = explode('?', $url);
if (isset($url[1])) $url_qs = $url[1];
$url = $url[0];
if (isset($url_qs)) $url = "{$url}?{$url_qs}";
if (count($qs)) return "{$url}?" . implode('&', $qs);
else return $url;
}
/**
* Make an HTTP request using cURL
*
* @param string $verb
* @param string $url
* @param array $params
*/
private function request($verb, $url, $params = array())
{
$ch = curl_init(); // the cURL handler
$url = $this->url($url); // the absolute URL
$request_headers = array();
if (!empty($this->token)) {
$request_headers[] = "Authorization: {$this->token}";
}
if ((!empty($this->ba_user)) AND (!empty($this->ba_password))) {
curl_setopt($ch, CURLOPT_USERPWD, $this->ba_user . ":" . $this->ba_password);
}
// encoded query string on GET
switch (true) {
case 'GET' == $verb:
$url = $this->urlQueryString($url, $params);
$this->last_url = $url;
break;
case in_array($verb, array('POST', 'PUT', 'DELETE')):
if ($this->post_type == 'json') {
$request_headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
} else {
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
}
}
if (!empty($this->user_agent)) {
curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
}
// set the URL
curl_setopt($ch, CURLOPT_URL, $url);
// set the HTTP verb for the request
switch ($verb) {
case 'POST':
curl_setopt($ch, CURLOPT_POST, true);
break;
case 'PUT':
case 'DELETE':
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $verb);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
if (!empty($this->port)) {
curl_setopt($ch, CURLOPT_PORT, $this->port);
}
$response = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$headers = http_parse_headers(substr($response, 0, $header_size));
$response = substr($response, $header_size);
$http_code = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
$content_error = curl_error($ch);
curl_close($ch);
if (strpos($content_type, 'json')) $response = json_decode($response, true);
switch (true) {
case 'GET' == $verb:
if ($http_code !== 200) {
$this->throw_error($response, $http_code);
}
return $response;
case in_array($verb, array('POST', 'PUT', 'DELETE')):
if (($http_code !== 303) AND ($http_code !== 200)) {
$this->throw_error($response, $http_code);
}
if ($http_code === 200) {
return $response;
} else {
return str_replace(rtrim($this->host, '/') . '/', '', $headers['Location']);
}
}
}
private function throw_error($response, $http_code)
{
if (is_array($response) && array_key_exists('error', $response)) {
if ((isset($response['error']['message'])) AND (isset($response['error']['code']))) {
if (is_array($response['error']['message'])) {
throw new RestClientException(implode("; ", $response['error']['message']), (int)$response['error']['code'], $http_code);
} else {
throw new RestClientException($response['error']['message'], (int)$response['error']['code'], $http_code);
}
} else {
throw new RestClientException(implode("; ", $response), 0, $http_code);
}
} else {
if (is_string($response)) {
throw new RestClientException($response, 0, $http_code);
} else {
}
}
}
/**
* Make an HTTP GET request
*
* @param string $url
* @param array $params
*/
public function get($url, $params = array())
{
return $this->request('GET', $url, $params);
}
/**
* Make an HTTP POST request
*
* @param string $url
* @param array $params
*/
public function post($url, $params = array())
{
return $this->request('POST', $url, $params);
}
/**
* Make an HTTP PUT request
*
* @param string $url
* @param array $params
*/
public function put($url, $params = array())
{
return $this->request('PUT', $url, $params);
}
/**
* Make an HTTP DELETE request
*
* @param string $url
* @param array $params
*/
public function delete($url, $params = array())
{
return $this->request('DELETE', $url, $params);
}
}
class RestClientException extends Exception
{
protected $http_code;
public function __construct($message, $code = 0, $http_code, Exception $previous = null)
{
$this->http_code = $http_code;
parent::__construct($message, $code, $previous);
}
public function getHttpCode()
{
return $this->http_code;
}
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message} (HTTP status code: {$this->http_code})\n";
}
}

323
autoload/RestClient3.php Normal file
View File

@@ -0,0 +1,323 @@
<?php
/**
* PHP 7.4-8.0 REST Client build with cURL
*
* @author Fabio Agostinho Boris <fabioboris@gmail.com>
* @added DataForSEO
*/
class RestClient {
public string $host; // the url to the rest server
public ?int $port = null;
public string $scheme;
public string $post_type = 'json';
public int $timeout = 60;
public int $connection_timeout = 10;
private ?string $token; // Auth token
private ?string $ba_user;
private ?string $ba_password;
private ?string $ba_ua;
public string $last_url = '';
public $last_response = null;
public $last_http_code = null;
public function __construct(string $host, string $token = null, string $ba_user = null, string $ba_password = null, string $ba_user_agent = null) {
$arr_h = parse_url($host);
if (isset($arr_h['port'])) {
$this->port = (int)$arr_h['port'];
$this->host = str_replace(":" . $this->port, "", $host);
} else {
$this->port = null;
$this->host = $host;
}
if (isset($arr_h['scheme'])) {
$this->scheme = $arr_h['scheme'];
}
$this->token = $token;
$this->ba_user = $ba_user;
$this->ba_password = $ba_password;
$this->ba_ua = $ba_user_agent;
}
/**
* Returns the absolute URL
*
* @param string $raw_headers
*/
private function http_parse_headers(string $raw_headers): array {
$headers = array();
$key = '';
foreach (explode("\n", $raw_headers) as $h) {
$h = explode(':', $h, 2);
if (isset($h[1])) {
if (!isset($headers[$h[0]])) {
$headers[$h[0]] = trim($h[1]);
} elseif (is_array($headers[$h[0]])) {
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
} else {
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
}
$key = $h[0];
} else {
if (substr($h[0], 0, 1) == "\t") {
$headers[$key] .= "\r\n\t" . trim($h[0]);
} elseif (!$key) {
$headers[0] = trim($h[0]);
}
}
}
return $headers;
}
/**
* Returns the absolute URL
*
* @param string|null $url
* @return string
*/
private function url(string $url = null): string {
$_host = rtrim($this->host, '/');
$_url = ltrim($url, '/');
return "{$_host}:{$this->port}/{$_url}";
}
/**
* Returns the URL with encoded query string params
*
* @param string $url
* @param array|null $params
* @return string
*/
private function urlQueryString(string $url, array $params = null): string {
$qs = array();
if ($params) {
foreach ($params as $key => $value) {
$qs[] = "{$key}=" . urlencode($value);
}
}
$url = explode('?', $url);
if (isset($url[1])) {
$url_qs = $url[1];
}
$url = $url[0];
if (isset($url_qs)) {
$url = "{$url}?{$url_qs}";
}
if (count($qs)) {
return "{$url}?" . implode('&', $qs);
} else {
return $url;
}
}
/**
* Make an HTTP request using cURL
*
* @param string $verb
* @param string $url
* @param array $params
*/
private function request(string $verb, string $url, array $params = array()) {
$ch = curl_init(); // the cURL handler
$url = $this->url($url); // the absolute URL
$request_headers = array();
if (!empty($this->token)) {
$request_headers[] = "Authorization: {$this->token}";
}
if ((!empty($this->ba_user)) and (!empty($this->ba_password))) {
curl_setopt($ch, CURLOPT_USERPWD, $this->ba_user . ":" . $this->ba_password);
}
// encoded query string on GET
switch (true) {
case 'GET' == $verb:
$url = $this->urlQueryString($url, $params);
break;
case in_array($verb, array(
'POST',
'PUT',
'DELETE'
), false):
if ($this->post_type == 'json') {
$request_headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
} else {
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
}
}
// set the URL
curl_setopt($ch, CURLOPT_URL, $url);
$this->last_url = $url;
// set the HTTP verb for the request
switch ($verb) {
case 'POST':
curl_setopt($ch, CURLOPT_POST, true);
break;
case 'PUT':
case 'DELETE':
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $verb);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connection_timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
if (!empty($this->ba_ua)) {
curl_setopt($ch, CURLOPT_USERAGENT, $this->ba_ua);
}
if (!empty($this->port)) {
curl_setopt($ch, CURLOPT_PORT, $this->port);
}
if ((!empty($this->scheme)) and ($this->scheme == 'https')) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
} else {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
$response = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$headers = $this->http_parse_headers(substr($response, 0, $header_size));
$response = substr($response, $header_size);
$http_code = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
$content_error = curl_error($ch);
//var_dump($content_error);
curl_close($ch);
if (strpos($content_type, 'json')) {
$response = json_decode($response, true);
}
$this->last_response = $response;
$this->last_http_code = $http_code;
switch (true) {
case 'GET' == $verb:
if ($http_code !== 200) {
if (is_array($response)) {
$this->throw_error($response, $http_code);
} else {
$this->throw_error(trim($content_error . "\n" . $response), $http_code);
}
}
return $response;
case in_array($verb, array(
'POST',
'PUT',
'DELETE'
), false):
if (($http_code !== 303) and ($http_code !== 200)) {
if (is_array($response)) {
$this->throw_error($response, $http_code);
} else {
$this->throw_error(trim($content_error . "\n" . $response), $http_code);
}
}
if ($http_code === 200) {
return $response;
} else {
return str_replace(rtrim($this->host, '/') . '/', '', $headers['Location']);
}
}
}
private function throw_error($response, $http_code) {
if (is_array($response) && array_key_exists('error', $response)) {
if ((isset($response['error']['message'])) and (isset($response['error']['code']))) {
if (is_array($response['error']['message'])) {
throw new RestClientException(implode("; ", $response['error']['message']), (int)$response['error']['code'], $http_code);
} else {
throw new RestClientException($response['error']['message'], (int)$response['error']['code'], $http_code);
}
} else {
throw new RestClientException(implode("; ", $response), 0, $http_code);
}
} else {
if (is_string($response)) {
return false;
// throw new RestClientException($response, 0, $http_code);
} else {
return false;
// throw new RestClientException(json_encode($response), 0, $http_code);
}
}
}
/**
* Make an HTTP GET request
*
* @param string $url
* @param array $params
*/
public function get($url, $params = array()) {
return $this->request('GET', $url, $params);
}
/**
* Make an HTTP POST request
*
* @param string $url
* @param array $params
*/
public function post($url, $params = array()) {
return $this->request('POST', $url, $params);
}
/**
* Make an HTTP PUT request
*
* @param string $url
* @param array $params
*/
public function put($url, $params = array()) {
return $this->request('PUT', $url, $params);
}
/**
* Make an HTTP DELETE request
*
* @param string $url
* @param array $params
*/
public function delete($url, $params = array()) {
return $this->request('DELETE', $url, $params);
}
}
class RestClientException extends Exception {
protected $http_code;
public function __construct(string $message, int $code = 0, int $http_code = 0, Exception $previous = null) {
$this->http_code = $http_code;
parent::__construct($message, $code, $previous);
}
/**
* @return int the http code error representation of the exception.
*/
public function getHttpCode() {
return $this->http_code;
}
/**
* @return string the string representation of the exception.
*/
public function __toString(): string {
return __CLASS__ . ": [{$this->code}]: {$this->message} (HTTP status code: {$this->http_code})\n";
}
}

1348
autoload/Savant3.php Normal file

File diff suppressed because it is too large Load Diff

390
autoload/class.Cron.php Normal file
View File

@@ -0,0 +1,390 @@
<?php
class Cron
{
public static function fill_missing_positions()
{
global $mdb;
$sites = $mdb -> select( 'pro_rr_sites', [ 'id', 'name' ], [ 'OR' => [ 'date_confirm' => date( 'Y-m-d' ), 'need_confirm' => 0 ] ] );
if ( is_array( $sites ) and !empty( $sites ) ) foreach ( $sites as $site )
{
$phrases = $mdb -> select( 'pro_rr_phrases', [ 'id', 'phrase' ], [ 'AND' => [ 'filled_missing_positions' => 0, 'site_id' => $site['id'] ], 'ORDER' => [ 'phrase' => 'ASC' ], 'LIMIT' => 1 ] );
if ( is_array( $phrases ) and !empty( $phrases ) ) foreach ( $phrases as $phrase )
{
$positions = $mdb -> select( 'pro_rr_phrases_positions', [ 'position', 'date' ], [ 'AND' => [ 'phrase_id' => $phrase['id'] ], 'ORDER' => [ 'date' => 'DESC' ], 'LIMIT' => 1 ] );
if ( is_array( $positions ) and !empty( $positions ) ) foreach ( $positions as $position )
{
$previous_position = $mdb -> get( 'pro_rr_phrases_positions', [ 'date', 'position', 'url', 'map' ], [ 'AND' => [ 'phrase_id' => $phrase['id'], 'date[!]' => $position[ 'date' ] ], 'ORDER' => [ 'date' => 'DESC' ] ] );
if ( $previous_position['position'] != 0 and $position['position'] != 0 )
$average_position = round( ( $position['position'] + $previous_position['position'] ) / 2, 0 );
else if ( $previous_position['position'] == 0 and $position['position'] != 0 )
$average_position = $position['position'];
else if ( $previous_position['position'] != 0 and $position['position'] == 0 )
$average_position = $previous_position['position'];
else
$average_position = 0;
$begin = new DateTime( date( 'Y-m-d', strtotime( '+1 days', strtotime( $previous_position['date'] ) ) ) );
$end = new DateTime( date( 'Y-m-d', strtotime( '-1 days', strtotime( $position['date'] ) ) ) );
for ( $i = $begin; $i <= $end; $i -> modify( '+1 day' ) )
{
if ( !$mdb -> count( 'pro_rr_phrases_positions', [ 'AND' => [ 'phrase_id' => $phrase['id'], 'date' => $i -> format( "Y-m-d" ) ] ] ) )
{
$mdb -> insert( 'pro_rr_phrases_positions', [
'position' => $average_position > 10 ? rand( $average_position - 1, $average_position + 1 ) : $average_position,
'phrase_id' => $phrase['id'],
'url' => $previous_position['url'],
'map' => $previous_position['map'],
'date' => $i -> format( "Y-m-d" )
] );
}
}
$mdb -> update( 'pro_rr_phrases', [ 'filled_missing_positions' => 1 ], [ 'id' => $phrase['id'] ] );
}
else
{
$mdb -> update( 'pro_rr_phrases', [ 'filled_missing_positions' => 1 ], [ 'id' => $phrase['id'] ] );
}
return [
'status' => 'ok',
'msg' => 'Uzupełniam brakujące pozycje: <b>' . $site['name'] . '</b> - <b>' . $phrase['phrase'] . '</b>.'
];
}
}
return [ 'status' => 'empty' ];
}
static public function archive_empty()
{
global $mdb;
$results = $mdb -> query( 'SELECT * FROM archive_phrases_positions WHERE date < \'' . date( 'Y-m-d', strtotime( '-4 years', time() ) ) . '\' ORDER BY id ASC LIMIT 1' ) -> fetchAll();
if ( is_array( $results ) and !empty( $results ) )
{
foreach ( $results as $row )
{
$mdb -> delete( 'archive_phrases_positions', [ 'id' => $row['id'] ] );
return [
'status' => 'ok',
'msg' => 'Usuwam stare pozycje fraz z archiwum | ID: <b>' . $row['id'] . '</b>, data: <b>' . $row['date'] . '</b>, URL: <b>' . $row['url'] . '</b>'
];
}
}
else
return [ 'status' => 'empty' ];
}
public static function archive_positions()
{
global $mdb;
$results = $mdb -> query( 'SELECT * FROM pro_rr_phrases_positions WHERE date LIKE \'' . date( 'Y-m', strtotime( '-2 years', time() ) ) . '%\' LIMIT 1' ) -> fetchAll();
if ( is_array( $results ) and !empty( $results ) )
{
foreach ( $results as $row )
{
$mdb -> insert( 'archive_phrases_positions', [
'phrase_id' => $row['phrase_id'],
'position' => $row['position'],
'url' => $row['url'],
'map' => $row['map'],
'date' => $row['date']
] );
$mdb -> delete( 'pro_rr_phrases_positions', [ 'id' => $row['id'] ] );
return [
'status' => 'ok',
'msg' => 'Archiwizuję stare pozycje fraz | ID: <b>' . $row['id'] . '</b>, data: <b>' . $row['date'] . '</b>'
];
}
}
else
return [ 'status' => 'empty' ];
}
public static function check_proxy()
{
global $mdb, $config;
$results = $mdb -> query( 'SELECT '
. 'id, proxy, errors '
. 'FROM '
. 'pro_proxy_servers '
. 'WHERE '
. '( DATE_ADD( last_checked, INTERVAL 1 DAY ) < NOW() OR last_checked IS NULL ) '
. 'ORDER BY '
. 'last_checked ASC '
. 'LIMIT 1' ) -> fetchAll();
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
{
$result = \GoogleSite::checkProxyServerVersion( $row['proxy'] );
if ( $result['code'] == 404 or $result['result'] == '' and $result['code'] == 0 )
{
$mdb -> update( 'pro_proxy_servers', [ 'errors' => $row['errors'] + 1, 'last_checked' => \S::getDate() ], [ 'id' => $row['id'] ] );
$mdb -> delete( 'pro_proxy_servers', [ 'errors[>=]' => 7 ] );
return [
'status' => 'ok',
'msg' => 'Sprawdzam poprawność proxy serwerowego: ' . $row['proxy'] . ' - ' . floatval( $result )
];
}
$ip = $result['info']['primary_ip'];
if ( !$result || $result != $config['proxy']['s-version'] )
$mdb -> update( 'pro_proxy_servers', [ 'last_checked' => \S::getDate(), 'errors' => 0, 'enabled' => 0, 'ip' => $ip ], [ 'id' => $row['id'] ] );
else
$mdb -> update( 'pro_proxy_servers', [ 'last_checked' => \S::getDate(), 'errors' => 0, 'enabled' => 1, 'ip' => $ip ], [ 'id' => $row['id'] ] );
return [
'status' => 'ok',
'msg' => 'Sprawdzam poprawność proxy serwerowego: ' . $row['proxy'] . ' - ' . floatval( $result )
];
}
return [ 'status' => 'empty' ];
}
static public function get_phrases_positions_dfs3()
{
global $mdb;
$row = $mdb -> get( 'pro_rr_phrases', '*', [ 'AND' => [ 'ds_ready' => 1, 'ds_id[!]' => null ] ] );
if ( $row )
{
$client = new RestClient( 'https://api.dataforseo.com/', null, 'pyziak84@gmail.com', '0p4rYWDNoK63eUUw' );
$result = $client->get('/v3/serp/google/organic/task_get/advanced/' . $row['ds_id'] );
if ( $result['status_code'] == '20000' )
{
$sites = $result['tasks'][0]['result'][0]['items'];
foreach ( $sites as $site )
{
if ( $site['type'] == 'organic' and \S::get_domain( $site['url'] ) == \S::get_domain( 'http://' . \factory\Ranker::get_domain_by_id( $row['site_id'] ) ) )
{
$phrase_position = $site['rank_group'];
$site_url = $site['url'];
break;
}
}
if ( $mdb -> count( 'pro_rr_phrases_positions', [ 'AND' => [ 'phrase_id' => $row['id'], 'date' => date( 'Y-m-d' ) ] ] ) )
{
$mdb -> update( 'pro_rr_phrases_positions', [
'position' => (int)$phrase_position,
'url' => $site_url,
], [
'AND' => [
'phrase_id' => $row['id'],
'date' => date( 'Y-m-d' )
]
] );
}
else
{
$mdb -> insert( 'pro_rr_phrases_positions', [
'phrase_id' => $row['id'],
'position' => (int)$phrase_position,
'url' => $site_url,
'date' => date( 'Y-m-d' )
] );
$last_id = $mdb -> get( 'phrase_positions_statistic', 'id', [ 'phrase_id' => $row['id'], 'ORDER' => [ 'date' => 'DESC' ] ] );
if ( $last_id )
$mdb -> query( 'DELETE FROM phrase_positions_statistic WHERE phrase_id = ' . $row['id'] . ' AND id NOT IN ( ' . $last_id . ' )' );
$mdb -> insert( 'phrase_positions_statistic', [
'phrase_id' => $row['id'],
'position' => $site['rank_group'],
'date' => date( 'Y-m-d' )
] );
}
$phrase_position = $site['rank_group'];
$mdb -> update( 'pro_rr_phrases', [ 'last_checked' => date( 'Y-m-d' ), 'filled_missing_positions' => 0, 'ds_id' => null, 'ds_ready' => 0 ], [ 'id' => $row['id'] ] );
return [
'status' => 'ok',
'msg' => 'Pobieramy wyniki dla frazy: <b>' . $row['phrase'] . '</b> - <b>' . (int)$phrase_position . '</b> - (API 3.0)'
];
}
return [
'status' => 'ok',
'msg' => 'Pobieramy wyniki dla frazy: <b>' . $row['phrase'] . '</b> - BŁĄD - (API 3.0)'
];
}
}
static public function post_phrases_positions_dfs3()
{
global $mdb;
$sql = 'SELECT * FROM ( '
. 'SELECT '
. 'prp.id, phrase, url, localization, last_checked, days_offset, prs.name '
. 'FROM '
. 'pro_rr_phrases AS prp, pro_rr_sites AS prs '
. 'WHERE '
. 'prs.id = prp.site_id '
. 'AND '
. 'last_checked != \'' . date( 'Y-m-d' ) . '\' '
. 'AND '
. '( prp.date_end >= \'' . date( 'Y-m-d' ) . '\' OR prp.date_end IS NULL ) '
. 'AND '
. '( prp.date_start <= \'' . date( 'Y-m-d' ) . '\' OR prp.date_start IS NULL ) '
. 'AND '
. '( prs.date_start <= \'' . date( 'Y-m-d' ) . '\' OR prs.date_start IS NULL ) '
. 'AND '
. '( prs.date_end >= \'' . date( 'Y-m-d' ) . '\' OR prs.date_end IS NULL ) '
. 'AND '
. 'ds_id IS NULL '
. ') AS q1 '
. 'WHERE '
. '( '
. 'days_offset IS NULL '
. 'OR '
. 'days_offset IS NOT NULL AND DATE( DATE_ADD( last_checked, INTERVAL +days_offset DAY ) ) <= CURRENT_DATE '
. ') OR last_checked = \'2012-01-01\' '
. 'ORDER BY '
. 'name ASC, phrase ASC '
. 'LIMIT 1';
$results = $mdb -> query( $sql ) -> fetchAll( \PDO::FETCH_ASSOC );
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
{
$client = new RestClient( 'https://api.dataforseo.com/', null, 'pyziak84@gmail.com', '0p4rYWDNoK63eUUw' );
if ( $row['localization'] and (int)$row['localization'] )
{
$post_array[0] = array(
"language_name" => "Polish",
"location_code" => $row['localization'],
"keyword" => mb_convert_encoding( $row['phrase'], "UTF-8" ),
"priority" => 1,
'postback_data' => 'advanced',
'postback_url' => 'http://www.rank24.pl/dsf.php?d4s-id=$id'
);
}
else
{
$post_array[0] = array(
"language_name" => "Polish",
"location_code" => $row['localization'],
"keyword" => mb_convert_encoding( $row['phrase'], "UTF-8" ),
"priority" => 1,
'postback_data' => 'advanced',
'postback_url' => 'http://www.rank24.pl/dsf.php?d4s-id=$id'
);
}
$task_post_result = $client -> post( '/v3/serp/google/organic/task_post', $post_array );
if ( $task_post_result['status_code'] == '20000' )
{
$mdb -> update( 'pro_rr_phrases', [ 'ds_id' => $task_post_result['tasks'][0]['id'], 'ds_date' => date( 'Y-m-d' ) ], [ 'id' => $row['id'] ] );
return [
'status' => 'ok',
'msg' => 'Wysyłam do sprawdzenia frazę: <b>' . $row['phrase'] . '</b> - <b>' . $row['url'] . '</b> - (API 3.0) - ' . $task_post_result['tasks'][0]['id']
];
}
}
return [ 'status' => 'empty' ];
}
public static function check_phrases_positions_dfs()
{
global $mdb;
include 'autoload/RestClient.php';
$sql = 'SELECT * FROM ( '
. 'SELECT '
. 'prp.id, phrase, url, localization, last_checked, days_offset, prs.name '
. 'FROM '
. 'pro_rr_phrases AS prp, pro_rr_sites AS prs '
. 'WHERE '
. 'prs.id = prp.site_id '
. 'AND '
. 'last_checked != \'' . date( 'Y-m-d' ) . '\' '
. 'AND '
. '( prp.date_end >= \'' . date( 'Y-m-d' ) . '\' OR prp.date_end IS NULL ) '
. 'AND '
. '( prp.date_start <= \'' . date( 'Y-m-d' ) . '\' OR prp.date_start IS NULL ) '
. 'AND '
. '( prs.date_start <= \'' . date( 'Y-m-d' ) . '\' OR prs.date_start IS NULL ) '
. 'AND '
. '( prs.date_end >= \'' . date( 'Y-m-d' ) . '\' OR prs.date_end IS NULL ) '
. 'AND '
. 'ds_id IS NULL '
. ') AS q1 '
. 'WHERE '
. '( '
. 'days_offset IS NULL '
. 'OR '
. 'days_offset IS NOT NULL AND DATE( DATE_ADD( last_checked, INTERVAL +days_offset DAY ) ) <= CURRENT_DATE '
. ') OR last_checked = \'2012-01-01\' '
. 'ORDER BY '
. 'name ASC, phrase ASC '
. 'LIMIT 1';
$results = $mdb -> query( $sql ) -> fetchAll( \PDO::FETCH_ASSOC );
if ( is_array( $results ) and !empty( $results ) )
{
foreach ( $results as $row ) {
$client = new RestClient( 'https://api.dataforseo.com/', null, 'pyziak84@gmail.com', '0p4rYWDNoK63eUUw' );
if ( $row['localization'] and (int)$row['localization'] ) {
$post_array[0] = array(
"priority" => 1,
"site" => \S::get_domain( 'https://' . $row['url'] ),
"se_id" => 21,
"loc_id" => $row['localization'],
"key" => mb_convert_encoding( $row['phrase'], "UTF-8" ),
"key_id" => null,
'se_id' => 3433,
'postback_url' => 'http://www.rank24.pl/dsf.php'
);
}
else {
$post_array[0] = array(
"priority" => 1,
"site" => \S::get_domain( 'https://' . $row['url'] ),
"se_id" => 21,
"loc_name_canonical" => $row['localization'] ? $row['localization'] : 'Poland',
"key" => mb_convert_encoding( $row['phrase'], "UTF-8" ),
"key_id" => null,
'se_id' => 3433,
'postback_url' => 'http://www.rank24.pl/dsf.php'
);
}
$task_post_result = $client -> post( 'v2/rnk_tasks_post', array( 'data' => $post_array ) );
if ( $task_post_result['status'] == 'ok' ) {
$mdb -> update( 'pro_rr_phrases', [ 'ds_id' => $task_post_result['results'][0]['task_id'], 'ds_date' => date( 'Y-m-d' ) ], [ 'id' => $row['id'] ] );
if ( $row['localization'] != '' and !is_int( $row['localization'] ) ) {
$mdb -> update( 'pro_rr_phrases', [ 'localization' => $task_post_result['results'][0]['loc_id'] ], [ 'id' => $row['id'] ] );
}
return [
'status' => 'ok',
'msg' => 'Wysyłam do sprawdzenia frazę: <b>' . $row['phrase'] . '</b> - <b>' . $row['url'] . '</b>.'
];
}
}
}
return [ 'status' => 'empty' ];
}
}

222
autoload/class.DataBase.php Normal file
View File

@@ -0,0 +1,222 @@
<?php
class DataBase
{
public function SaveData( $db_edit_table , $db_edit_key , $db_edit_val , $db_edit_pols , $db_edit_pass , $db_edit_pols_t )
{
global $sys , $lang , $db;
$sql = '';
if ( is_array( $db_edit_pols ) ) foreach ( $db_edit_pols as $val )
{
if ( $sql && $val != 'image' )
$sql .= ',';
if ( $val != 'image' )
$sql .= $val . "='" . addslashes( \S::saveString( \S::get( $val ) ) ) . "'";
}
if ( $db_edit_pass )
{
$name = $db_edit_pass['nazwa1'];
$pass1 = \S::saveString( \S::get( $name ) );
$pass2 = \S::saveString( \S::get( $name . '_repeat' ) );
if ( $pass1 != $pass2 )
\S::alert( $lang -> getTrans( 'T_HASLA_ROZNE' ) );
else
{
if ( strlen($pass1) >= 5 )
{
if ( $sql )
$sql .= ',';
$sql .= $name . "='" . md5($pass1) . "'";
}
else
{
if ( strlen( $pass1 ) < 5 )
\S::alert( $lang -> getTrans( 'T_HASLA_ZA_KROTKIE' ) );
}
}
}
if ( $db_edit_table && $db_edit_key && $db_edit_val && $db_edit_pols )
{
$db_edit_table = \S::saveString( $db_edit_table );
$db_edit_key = \S::saveString( $db_edit_key );
$db_edit_val = \S::saveString( $db_edit_val );
$query = $db -> query( "UPDATE " . $db_edit_table . " SET " . $sql . " WHERE " . $db_edit_key . "='" . $db_edit_val . "'" );
for ( $i = 0; $i < count( $db_edit_pols_t ); $i++ )
{
if ( $db_edit_pols_t[$i] == 'file' && is_array( $_FILES[$db_edit_pols[$i]] ) )
{
$file = $_FILES[$db_edit_pols[$i]];
if ( $file['name'] )
$name = explode( '.' , $file['name'] );
if ( isset( $name ) && is_array( $name ) )
$patch = '../' . \S::get( 'image_folder' ) . \S::seo( $name[0]) . '.' . $name[1];
if ( $file['type'] == 'image/pjpeg' || $file['type'] == 'image/jpg' || $file['type'] == 'image/jpeg' || $file['type'] == 'image/gif' || $file['type'] == 'image/png' )
{
if ( $file['size'] < 500000 )
{
$x = getimagesize( $file['tmp_name'] );
if ( is_array( $x ) or $x[0] < 2)
{
$query = $db -> prepare( "SELECT " . $db_edit_pols[$i] . " FROM " . $db_edit_table . " WHERE " . $db_edit_key . "='" . $db_edit_val . "'" );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$plik = '../' . $row[0];
if ( file_exists( $plik ) && $row[0] )
unlink( $plik );
}
$query -> closeCursor();
if ( file_exists( $patch ) )
unlink( $patch );
rename( $file['tmp_name'] , $patch );
chmod( $patch , 0755 );
$patch = str_replace( '../' , '' , $patch );
$query = $db -> query( "UPDATE " . $db_edit_table . " SET " . $db_edit_pols[$i] ."='" . $patch . "' WHERE " . $db_edit_key . "='" . $db_edit_val . "'" );
}
}
}
}
}
\S::alert( 'Zaktualizowano wybrany element.' );
}
$saveFlag = true;
\S::deleteCacheAdmin();
\S::deleteCache();
}
public function addData( $db_edit_table , $db_edit_pols , $db_edit_pols_hidden , $db_edit_pols_t , $time , $db_edit_pass = '' )
{
global $sys , $lang , $db;
$flag = true;
$idk = '';
$key = '';
$val = '';
$value = '';
if ( $time == \S::get_session( 'dbedit_add_time' ) ) return false;
if ( is_array( $db_edit_pols ) ) foreach ( $db_edit_pols as $val )
{
if ( !$idk )
$idk = $val;
if ( $key )
$key .= ',';
if ( $value )
$value .= ',';
$key .= $val;
$value .= "'" . \S::saveString( \S::get( $val ) ) . "'";
}
if ( is_array( $db_edit_pols_hidden ) ) foreach ( $db_edit_pols_hidden as $val )
{
if ( $key )
$key .= ',';
if ( $value )
$value .= ',';
$key .= $val;
$value .= "'" . \S::saveString( \S::get( $val ) ) . "'";
}
if ( $db_edit_pass )
{
$name = $db_edit_pass['nazwa1'];
$pass1 = \S::saveString( \S::get( $name ) );
$pass2 = \S::saveString( \S::get( $name . '_repeat' ) );
if ( $pass1 != $pass2 )
{
\S::alert( $lang -> getTrans( 'T_HASLA_ROZNE' ) );
$flag = false;
}
else
{
if ( strlen($pass1) >= 5 )
{
if ( $key )
$key .= ',';
$key .= $name;
if ( $value )
$value .= ',';
$value .= "'" . md5( $pass1 ) . "'";
}
else
{
if ( $pass1 )
{
$flag = false;
\S::alert( $lang -> getTrans( 'T_HASLA_ZA_KROTKIE' ) );
}
}
}
}
if ( $db_edit_table && $db_edit_pols && $flag )
{
$check = true;
$db_edit_table = \S::saveString( $db_edit_table );
try
{
$query = $db -> prepare( "INSERT INTO " . $db_edit_table . " (" . $key . ") VALUES (" . $value . ")");
$query -> execute();
}
catch(PDOException $e)
{
$check = false;
}
$id = $db -> lastInsertId();
$query -> closeCursor();
for ( $i = 0; $i < count( $db_edit_pols_t ); $i++ )
{
if ( $db_edit_pols_t[$i] == 'file' && is_array($_FILES[$db_edit_pols[$i]]) )
{
$file = $_FILES[$db_edit_pols[$i]];
$name = explode( '.' , $file['name'] );
$patch = '../' . \S::get( 'image_folder' ) . \S::seo( $name[0] ) . '.' . $name[1];
if ( $file['type'] == 'image/pjpeg' || $file['type'] == 'image/jpg' || $file['type'] == 'image/jpeg' || $file['type'] == 'image/gif' || $file['type'] == 'image/png' )
{
if ( $file['size'] < 500000 )
{
$x = getimagesize( $file['tmp_name'] );
if ( is_array( $x ) or $x[0] < 2)
{
if ( file_exists( $patch ) )
unlink( $patch );
@rename( $file['tmp_name'] , $patch );
chmod( $patch , 0755 );
$patch = str_replace( '../' , '' , $patch );
$query = $db -> prepare( "UPDATE " . $db_edit_table . " SET " . $db_edit_pols[$i] . "='" . $patch . "' WHERE id='" . $id . "'" );
$query -> execute();
$query -> closeCursor();
}
}
}
}
}
if ( $check )
\S::alert( 'Dodano nowy element.' );
else
\S::alert( 'Nieprawidłowe dane.' );
$addFlag = true;
}
else
\S::alert( 'Nieprawidłowe dane.' );
\S::set_session( 'dbedit_add_time' , $time );
\S::deleteCacheAdmin();
\S::deleteCache();
}
}
?>

View File

@@ -0,0 +1,525 @@
<?php
class DataBrowse {
private $_table;
private $_filtr;
private $_field_id;
private $_field_name;
private $_field_link;
private $_field_style;
private $_quantity;
private $_select;
private $_field_simple_id;
private $_param;
private $_field_action;
private $_field_tran;
private $_row_number;
private $_count;
private $_page_number;
private $_sort;
private $_filtr_id;
private $_filtr_name;
private $_filtr_field_tran;
private $_filtr_quantity;
private $_db_filtr;
private $_db_filtr_value;
private $_is_lp;
private $_lp;
private $_group_by;
private $_filtr_type;
private $_debug;
private $_limit = 10;
private $_filed_sort;
private $_sort_name;
private $_sort_way;
private $_paging_adress = './';
private $_cut;
private $_checkbox = false;
private $_menu = false;
function DataBrowse( $table , $filtr = '' , $debug = false )
{
$this -> _table = $table;
$this -> _filtr = $filtr;
$this -> _quantity = 0;
$this -> _filtr_quantity = 0;
$this -> _debug = $debug;
}
public function addMenu( $html )
{
$this -> _menu = $html;
}
public function addCheckbox()
{
$this -> _checkbox = true;
}
function addGroupBy( $value )
{
$this -> _group_by = $value;
}
function addLp()
{
$this -> _is_lp = true;
$this -> _lp = true;
}
function setLimit( $val )
{
$this -> _limit = $val;
}
function addFiltr( $id , $nazwa , $tab = '' , $sql = '' )
{
global $db;
if ( $nazwa )
{
$this -> _filtr_id[ $this -> _filtr_quantity ] = $id;
$this -> _filtr_name[ $this -> _filtr_quantity ] = $nazwa;
if ( $sql )
{
$query = $db -> prepare( $sql );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$tab[ $row[0] ] = $row[1];
$query -> closeCursor();
}
if ( is_array($tab) )
$this -> _filtr_field_tran[$this -> _filtr_quantity] = $tab;
else
{
if ( !$tab )
$tab = 'text';
$this -> _filtr_type[ $this -> _filtr_quantity ] = $tab;
}
$this -> _filtr_quantity++;
}
}
function addPosition( $id , $nazwa , $link = '' , $tab = '' , $style = '' , $sort = false, $cut = true )
{
global $db;
if ( $nazwa )
{
$this -> _field_id[ $this -> _quantity ] = $id;
$this -> _field_name[ $this -> _quantity ] = $nazwa;
$this -> _field_link[ $id ] = $link;
$this -> _field_style[ $id ] = $style;
$this -> _filed_sort[ $this -> _quantity ] = $sort;
$this -> _field_cut[ $id ] = $cut;
if ( is_array( $tab ) )
$this -> _field_tran[$id] = $tab;
else
{
if ( $tab )
{
$query = $db -> prepare($tab);
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$tabs[$res[0]] = $res[1];
$query -> closeCursor();
$tabs[0] = '';
$this -> _field_tran[$id] = $tabs;
}
}
$this -> _quantity ++;
}
}
function addPositionSimple( $id , $nazwa , $link = '' , $akcja = '' , $style = '' )
{
$this -> _field_simple_id[$this -> _quantity] = $id;
$this -> _field_name[$this -> _quantity] = $nazwa;
$this -> _field_link[$id] = $link;
$this -> _field_action[$id] = $akcja;
$this -> _field_style[$id] = $style;
$this -> _filed_sort[ $this -> _quantity ] = false;
$this -> _quantity++;
}
function setParam( $param )
{
$this -> _param = $param;
}
function addSort( $sort )
{
$this -> _sort = $sort;
}
function draw()
{
global $db , $bs;
$out = '';
$filtr_ttext = '';
$filtr_combo = '';
$table_values = '';
$filtr_text = '';
if ( \S::get( 'bs' ) ) {
\S::set_session( $this -> _table . '_bs' , \S::get('bs' ) );
}
$bs = \S::get_session( $this -> _table . '_bs' );
$page_type = \S::get_session( 'page-type' );
if ( \S::get( 's' ) )
{
if ( \S::get_session( $this -> _table . '_sort' . \S::get( 's' ) ) == 'DESC' )
\S::set_session( $this -> _table . '_sort' . \S::get( 's' ) , 'ASC' );
else
\S::set_session( $this -> _table . '_sort' . \S::get( 's' ) , 'DESC' );
\S::set_session( $this -> _table . '_sort_by', \S::get( 's' ) );
}
$sort = \S::get_session( $this -> _table . '_sort_by' );
if ( $sort )
{
$this -> _sort = $sort . ' ' . \S::get_session( $this -> _table . '_sort' . $sort );
$this -> _sort_name = $sort;
$this -> _sort_way = \S::get_session( $this -> _table . '_sort' . $sort );
}
if ( \S::get( 'r' ) )
\S::set_session( $this -> _table . '_limit' , \S::get( 'r' ) );
$limit = \S::get_session( $this -> _table . '_limit' );
if ( !$limit )
$limit = $this -> _limit;
switch ( $limit )
{
case 5:
$this -> _limit = 5;
break;
case 10:
$this -> _limit = 10;
break;
case 25:
$this -> _limit = 25;
break;
case 50:
$this -> _limit = 50;
break;
case 100:
$this -> _limit = 100;
break;
default:
$this -> _limit = 25;
break;
}
if ( \S::get( 'set_db_filtr' ) == 'yes' )
{
if ( is_array( $_POST ) ) foreach ( $_POST as $key => $val )
{
if ( $key != 'set_db_filtr' && $val != '' && $key != 'rows' )
{
$this -> _db_filtr_value[$key] = $val;
$pos_title = array_search( $this -> _db_filtr_value[ $key ] , $this -> _db_filtr_value );
$position = array_search( $pos_title , $this -> _filtr_id );
if ( $this -> _db_filtr && strpos( $key , '{trans}_trans' ) === false )
$this -> _db_filtr .= ' AND ';
if ( isset( $this -> _filtr_type[ $position ] ) && $this -> _filtr_type[ $position ] == 'text' )
$this -> _db_filtr .= " $key LIKE '%$val%' ";
else
{
if ( strpos( $key , '{trans}_trans' ) === false )
{
if ( strpos( $key , '{trans}' ) && is_array( \S::get( $key . '_trans' ) ) )
{
$count = 0;
foreach ( \S::get( $key . '_trans' ) as $value_tmp )
{
$value_tmp = explode( '[]' , $value_tmp );
if ( strpos( strtolower( $value_tmp[1] ) , strtolower( $val ) ) !== false )
{
if ( $this -> _db_filtr )
$this -> _db_filtr .= ' OR ';
$this -> _db_filtr .= str_replace( '{trans}' , '' , $key ) . " = '" . $value_tmp[0] . "'";
}
else
$count++;
}
if ( count( \S::get( $key . '_trans' ) ) == $count )
$this -> _db_filtr .= str_replace( '{trans}' , '' , $key ) . " = ''";
}
else
$this -> _db_filtr .= " $key = '$val'";
}
}
}
}
\S::set_session( 'db_filtr_' . $page_type , $this -> _db_filtr );
\S::set_session( 'db_filtr_value_' . $page_type , $this -> _db_filtr_value );
}
if ( \S::get( 'set_db_filtr' ) == 'no' )
{
\S::deleteSessionVar( 'db_filtr_' . $page_type );
\S::deleteSessionVar( 'db_filtr_value_' . $page_type );
}
$this -> _db_filtr = \S::get_session( 'db_filtr_' . $page_type );
$this -> _db_filtr_value = \S::get_session( 'db_filtr_value_' . $page_type );
$tpl = new \Savant3;
if ( is_array( $this -> _filtr_id ) )
{
$tpl -> _filtr = true;
for ( $x = 0; $x < $this -> _filtr_quantity; $x++ )
{
if ( isset( $this -> _filtr_field_tran[$x] ) )
{
if ( strpos( $this -> _filtr_id[$x] , '{trans}' ) !== false )
{
$filtr_tt['name'] = $this -> _filtr_name[ $x ];
$filtr_tt['seo_name'] = $this -> _filtr_id[ $x ];
if ( isset( $this -> _db_filtr_value[ $this -> _filtr_id[ $x ] ] ))
$filtr_tt['value'] = $this -> _db_filtr_value[ $this -> _filtr_id[ $x ] ];
else
$filtr_tt['value'] = '';
if ( is_array($this -> _filtr_field_tran[$x]) ) foreach ( $this -> _filtr_field_tran[$x] as $key => $val )
$filtr_tt['select'][$key] = $val;
$filtr_ttext[] = $filtr_tt;
}
else
{
$filtr_c = '';
$filtr_c['name'] = $this -> _filtr_name[$x];
$filtr_c['seo_name'] = $this -> _filtr_id[$x];
if ( is_array( $this -> _filtr_field_tran[$x] ) ) foreach ( $this -> _filtr_field_tran[$x] as $key => $val )
$filtr_c['value'][$key] = $val;
if ( isset( $this -> _db_filtr_value[$this -> _filtr_id[$x]] ) )
$filtr_c['val'] = $this -> _db_filtr_value[$this -> _filtr_id[$x]];
$filtr_combo[] = $filtr_c;
}
}
if ( isset( $this -> _filtr_type[$x] ) && $this -> _filtr_type[$x] == 'text' )
{
$filtr_t['name'] = $this -> _filtr_name[$x];
$filtr_t['seo_name'] = $this -> _filtr_id[$x];
if ( isset( $this -> _db_filtr_value[$this -> _filtr_id[$x]] ) )
$filtr_t['value'] = $this -> _db_filtr_value[$this -> _filtr_id[$x]];
else
$filtr_t['value'] = '';
$filtr_text[] = $filtr_t;
}
if ( isset( $this -> _filtr_type[$x] ) && $this -> _filtr_type[$x] == 'text-trans' )
{
$filtr_tt['name'] = $this -> _filtr_name[ $x ];
$filtr_tt['seo_name'] = $this -> _filtr_id[ $x ];
$filtr_tt['value'] = $this -> _db_filtr_value[ $this -> _filtr_id[ $x ] ];
if ( is_array($this -> _filtr_field_tran[$x]) ) foreach ( $this -> _filtr_field_tran[$x] as $key => $val )
$filtr_tt['select'][$key] = $val;
$filtr_ttext[] = $filtr_tt;
}
}
$tpl -> _filtr_ttext = $filtr_ttext;
$tpl -> _filtr_combo = $filtr_combo;
$tpl -> _filtr_text = $filtr_text;
}
if ( is_array($this -> _field_id) ) foreach ( $this -> _field_id as $p )
{
if ( !$this -> _select )
{
$this -> _select = $p;
if ( !$this -> _param )
$this -> _param = $p;
}
else
$this -> _select .= ", $p";
}
if ( is_array( $this -> _field_id ) && !in_array( $this -> _param,$this -> _field_id ) )
$this -> _select .= ", " . $this -> _param;
$sql_t = "SELECT count(1) FROM " . $this -> _table;
$sql = "SELECT " . $this -> _select . " FROM " . $this -> _table;
if ( $this -> _filtr )
{
$sql .= " WHERE " . $this -> _filtr;
$sql_t .= " WHERE " . $this -> _filtr;
}
if ( $this -> _filtr && $this -> _db_filtr )
{
$sql .= " AND " . $this -> _db_filtr;
$sql_t .= " AND " . $this -> _db_filtr;
}
else if ( !$this -> _filtr && $this -> _db_filtr )
{
$sql .= " WHERE " . $this -> _db_filtr;
$sql_t .= " WHERE " . $this -> _db_filtr;
}
if ( $this -> _group_by )
{
$sql .= ' GROUP BY ' . $this -> _group_by;
$sql_t .= ' GROUP BY ' . $this -> _group_by;
}
if ( $this -> _sort )
{
$sql .= " ORDER BY " . $this -> _sort;
$sql_t .= " ORDER BY " . $this -> _sort;
}
$query = $db -> prepare ($sql_t) ;
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$count_rows = $row[0];
$ls = ceil( $count_rows / $this -> _limit );
if ( (int)$bs > $ls )
$bs = $ls;
if ( (int)$bs < 1 )
$bs = 1;
$a = \S::getPagingVar( 'a' , $bs , $ls );
$b = \S::getPagingVar( 'b' , $bs , $ls );
$tpl -> _a = $bs - $b;
$tpl -> _b = $bs + $a;
$tpl -> _ls = $ls;
$tpl -> _link = $this -> _paging_adress;
$tpl -> _bs = $bs;
if ( $this -> _limit )
$sql .= " LIMIT " . ( $bs - 1 ) * $this -> _limit . "," . $this -> _limit;
$query = $db -> prepare( $sql );
$query -> execute();
if ( $this -> _debug )
print_r ($query -> errorInfo() );
$tpl -> _row_count = $query -> rowCount();
for ( $i = 0; $i < $this -> _quantity; $i++ )
{
if ( $this -> _is_lp )
{
$header[0]['value'] = 'Lp.';
$this -> _is_lp = false;
}
if ( $this -> _checkbox )
$header[1]['value'] = '';
$row['value'] = $this -> _field_name[$i];
$row['sort'] = false;
$row['way'] = false;
if ( $this -> _filed_sort[$i] )
{
$row['sort'] = $this -> _filed_sort[$i];
if ( $this -> _sort_name == $this -> _filed_sort[$i] )
$row['way'] = $this -> _sort_way;
}
$header[] = $row;
}
$tpl -> _table_headers = $header;
$i = $this -> _row_number * ( $bs - 1 ) + 1;
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( $this -> _lp )
{
$values['lp']['style'] = 'text-align:center;';
$values['lp']['value'] = ( $bs - 1 ) * $this -> _limit + $i . '.';
}
if ( $this -> _checkbox )
{
$values['checkbox']['value'] = '<input type="checkbox" name="checkbox" value="' . $row[ $this -> _param ] . '">';
}
if ( is_array($this -> _field_id) ) foreach ( $this -> _field_id as $key )
{
if ( isset( $this -> _field_tran[$key] ) && is_array($this -> _field_tran[$key]) )
{
if ( $this -> _field_link[$key] )
$val_temp = '<a href="' . $this -> _field_link[$key] . '&id=' . $row[$this -> _param] . '">';
else
$val_temp = '';
if ( isset( $this -> _field_tran[$key][$row[$key]] ) )
{
if ( strlen( $this -> _field_tran[$key][$row[$key]] ) > 40 && $this -> _field_cut[$key] )
$val_temp .= mb_substr( $this -> _field_tran[$key][$row[$key]] , 0 , 40 , 'UTF-8' ) . '...';
else
{
if ( $this->_field_tran[$key][$row[$key]] )
$val_temp .= $this -> _field_tran[$key][$row[$key]];
else
$val_temp .= '';
}
}
else
$val_temp .= '';
if ( $this -> _field_link[$key] )
$val_temp .= '</a>';
$values[$key]['value'] = $val_temp;
}
else
{
if ( strlen( $row[$key] ) > 40 && $this -> _field_cut[$key] )
$values[$key]['value'] = mb_substr( strip_tags( $row[$key] ) , 0 , 40 , 'UTF-8' ) . '...';
else
$values[$key]['value'] = $row[$key];
}
$values[$key]['style'] = $this -> _field_style[$key];
}
if ( is_array( $this -> _field_simple_id ) ) foreach ( $this -> _field_simple_id as $key )
{
$val_temp = '';
$class = '';
if ( $this -> _field_link[$key] )
$val_temp .= '<a class="' . $class . '" href="' . $this -> _field_link[$key] . '&id=' . $row[$this -> _param] . '">';
if ( $this -> _field_action[$key] )
$val_temp .= '<a class="' . $class . '" ' . str_replace('[param]',$row[$this -> _param],$this -> _field_action[$key]) . '>';
if ( $key == 'usuń' )
$val_temp .= "<span class='icon delete tip' title='Usuń'></span>";
else if ( $key == 'edytuj' )
$val_temp .= "<span class='icon edit tip' title='Edytuj' id='" . $row[$this -> _param] . "'></span>";
else if ( $key == 'pokaż' )
$val_temp .= "<span class='icon show'></span>";
else
$val_temp .= $key;
if ( $this -> _field_link[$key] || $this -> _field_action[$key] )
$val_temp .= '</a>';
$values[$key]['style'] = $this -> _field_style[$key];
$values[$key]['value'] = $val_temp;
}
$table_values[] = $values;
$i++;
}
$tpl -> _menu = $this -> _menu;
$tpl -> _table_values = $table_values;
$tpl -> _limit = $this -> _limit;
$tpl -> _start = $count_rows == 0 ? 0 : $this -> _limit * ( $bs - 1 ) + 1;
$tpl -> _end = $this -> _limit * $bs > $count_rows ? $count_rows : $this -> _limit * $bs;
$tpl -> _total = $count_rows;
$tpl -> _checkbox = $this -> _checkbox;
$out .= $tpl -> fetch( 'database/data-browse' );
return $out;
}
}
?>

364
autoload/class.DataEdit.php Normal file
View File

@@ -0,0 +1,364 @@
<?php
class DataEdit
{
private $_table;
private $_key;
private $_val;
private $_field_id;
private $_field_name;
private $_field_type;
private $_field_action;
private $_quantity;
private $_select;
private $_password;
private $_pass;
private $_form_id;
private $_quantity_hidden;
private $_field_value_hidden;
private $_field_key_hidden;
private $_upload_quantity;
private $_field_upload;
private $_cancel_button;
private $_param;
private $_field_tab;
private $_field_title;
private $_menu;
function addMenu( $html )
{
$this -> _menu = $html;
}
function DataEdit( $table , $key = '' , $val = '' , $adres = 'index.php' )
{
$this -> _table = $table;
$this -> _adres = $adres;
$this -> _quantity = 0;
$this -> _quantity_hidden = 0;
if ( $key && $val )
{
$this -> _key = $key;
$this -> _val = $val;
}
}
function addPositionHidden( $key , $val )
{
$this -> _field_value_hidden[ $this -> _quantity_hidden ] = $val;
$this -> _field_key_hidden[ $this -> _quantity_hidden ] = $key;
$this -> _quantity_hidden ++;
}
function addCancelButton( $nazwa , $key = '' , $val = '' )
{
$this -> _cancel_button['nazwa'] = $nazwa;
$this -> _cancel_button['key'] = $key;
$this -> _cancel_button['val'] = $val;
}
function setFormId( $id )
{
$this -> _form_id = $id;
}
function addPosition( $id , $nazwa , $typ , $action = '' , $tab = '' , $empty = false, $title = '' )
{
global $db;
$this -> _field_id[$this -> _quantity] = $id;
$this -> _field_name[$this -> _quantity] = $nazwa;
$this -> _field_type[$this -> _quantity] = $typ;
$this -> _field_action[$this -> _quantity] = $action;
$this -> _field_title[$this -> _quantity] = $title;
if ( is_array( $tab ) )
$this -> _field_tab[$this -> _quantity] = $tab;
else
{
if ( $tab )
{
$query = $db -> prepare($tab);
$query -> execute();
if ( $empty )
$tabs[''] = '';
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$tabs[$res[0]] = $res[1];
$this -> _field_tab[$this -> _quantity] = $tabs;
}
}
$this -> _quantity ++;
}
function addHiddenParam( $id )
{
$this -> _param = $id;
}
function setSubmitButton( $button )
{
$this -> _button_submit = $button;
}
function addPositionPassword( $nazwa = '' , $action1 = '' , $action2 = '' )
{
$this -> _password = true;
if ( isset( $nazwa ) )
{
$nazwa1 = 'password';
$nazwa2 = 'password_repeat';
}
else
$nazwa2 = $nazwa . '_repeat';
$this -> _pass['nazwa1'] = $nazwa1;
$this -> _pass['nazwa2'] = $nazwa2;
$this -> _pass['action1'] = $action1;
$this -> _pass['action2'] = $action2;
}
function setUploadFolder( $id , $folder )
{
$this -> _upload_quantity ++;
$this -> _field_upload[$this -> _upload_quantity]['id'] = $id;
$this -> _field_upload[$this -> _upload_quantity]['folder'] = $folder;
}
function draw()
{
global $sys , $db , $lang;
$hidden_tab = '';
$hidden_param_tab = '';
$out = '';
\S::set_session( 'db_edit_table' , $this -> _table );
\S::set_session( 'db_edit_key' , $this -> _key );
\S::set_session( 'db_edit_val' , $this -> _val );
\S::set_session( 'db_edit_pols' , $this -> _field_id );
\S::set_session( 'db_edit_pass' , $this -> _pass );
\S::set_session( 'db_edit_pols_hidden', $this -> _field_key_hidden );
\S::set_session( 'db_edit_pols_type' , $this -> _field_type );
if ( !$this -> _form_id )
$this -> _form_id = 'formularz';
$flaga = false;
if ( is_array( $this -> _field_id ) ) foreach ( $this -> _field_id as $p )
{
if ( !$this -> _select )
$this -> _select = $p;
else
$this -> _select .= ', ' . $p;
}
if ( $this -> _param )
$this -> _select .= ", " . $this -> _param;
if ( $this -> _key )
$flaga = true;
if ( $flaga )
{
$query = $db -> prepare( 'SELECT ' . $this -> _select . ' FROM ' . $this -> _table . ' WHERE ' . $this -> _key . '="' . $this -> _val . '"' );
$query->execute();
}
$tpl = new \Savant3;
$tpl -> _form_adress = $this -> _adres;
$tpl -> _form_id = $this -> _form_id;
if ( is_array( $this -> _field_key_hidden ) )
{
for ( $j = 0; $j < $this -> _quantity_hidden; $j++ )
{
$hidden['name'] = $this -> _field_key_hidden[$j];
$hidden['value'] = $this -> _field_value_hidden[$j];
$hidden_tab[] = $hidden;
}
}
$tpl -> _hidden_tab = $hidden_tab;
$tpl -> _form_key = $this -> _key;
$tpl -> _form_val = $this -> _val;
if ( $flaga )
{
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
{
if ( $this -> _param )
{
$hidden_param['name'] = $this -> _param;
$hidden_param['value'] = $res[$this -> _param];
$hidden_param_tab[] = $hidden_param;
}
}
}
$tpl -> _hidden_param_tab = $hidden_param_tab;
for ( $i = 0; $i < $this -> _quantity; $i++ )
{
$table_edit['tr_id'] = $this -> _field_id[$i];
$table_edit['name'] = $this -> _field_name[$i];
if ( $this -> _field_type[$i] == "label" )
{
$table_edit['type'] = 'label';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
$table_edit['input_action'] = $this -> _field_action[$i];
$table_edit['input_title'] = $this -> _field_title[$i];
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$table_edit['input_value'] = $res[$i];
}
else
$table_edit['input_value'] = '';
if ( isset( $this -> _filed_tab[$i] ) && is_array( $this -> _field_tab[$i] ) ) foreach ( $this -> _field_tab[$i] as $key => $val )
{
if ( $flaga )
{
if ( $key == $res[$i] )
$table_edit['text'] = $val;
}
}
else
$table_edit['text'] = $res[$i];
}
else if ( $this -> _field_type[$i] == 'text' )
{
$table_edit['type'] = 'text';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
$table_edit['input_action'] = $this -> _field_action[$i];
$table_edit['input_title'] = $this -> _field_title[$i];
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$table_edit['input_value'] = $res[$i];
}
else
$table_edit['input_value'] = '';
}
else if ( $this -> _field_type[$i] == 'radio' )
{
$table_edit['type'] = 'radio';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
$table_edit['input_action'] = $this -> _field_action[$i];
$table_edit['input_title'] = $this -> _field_title[$i];
$value = '';
if ( is_array( $this -> _field_tab[$i] ) ) foreach ( $this -> _field_tab[$i] as $key => $val )
{
$value[$key] = $lang -> getTrans( $val );
$table_edit['input_value'] = $value;
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
{
if ( $key == $res[$i] )
$table_edit['var'] = $res[$i];
}
}
}
else
$table_edit['input_value'] = '';
}
else if ( $this -> _field_type[$i] == 'textarea' )
{
$table_edit['type'] = 'textarea';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$table_edit['input_value'] = $res[$i];
}
else
$table_edit['input_value'] = '';
}
else if ( $this -> _field_type[$i] == 'file' )
{
$table_edit['type'] = 'file';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = 'image';
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$table_edit['input_value'] = $res[$i];
}
else
$table_edit['input_value'] = '';
}
else if ( $this -> _field_type[$i] == 'combo' )
{
$table_edit['type'] = 'combo';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
$table_edit['input_action'] = $this -> _field_action[$i];
$table_edit['input_title'] = $this -> _field_title[$i];
$value = '';
if ( isset( $this -> _field_tab[$i] ) && is_array( $this -> _field_tab[$i] ) ) foreach ( $this -> _field_tab[$i] as $key => $val )
{
$value[$key] = $val;
$table_edit['input_value'] = $value;
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
{
if ( $key == $res[$i] )
$table_edit['var'] = $res[$i];
}
}
}
else
$table_edit['input_value'] = '';
}
$table_edit_tab[] = $table_edit;
}
if ( $this -> _password )
{
$tpl -> _password = $this -> _password;
$tpl -> _pass_name1 = $this -> _pass['nazwa1'];
$tpl -> _pass_action = $this -> _pass['action1'];
$tpl -> _pass_name2 = $this -> _pass['nazwa2'];
$tpl -> _pass_action2 = $this -> _pass['action2'];
}
if ( is_array( $this -> _field_upload ) )
{
$tpl -> _file_upload = true;
for ( $j=1; $j<=$this -> _upload_quantity; $j++ )
{
$upload['name'] = $this -> _field_upload[$j]['id'] . '_folder';
$upload['value'] = $this -> _field_upload[$j]['folder'];
$upload_tab[] = $upload;
}
$tpl -> _upload_tab = $upload_tab;
}
if ( $this -> _cancel_button )
{
$tpl -> _cancel_button = true;
$tpl -> _cancel_adress = $this -> _adres;
$tpl -> _cancel_name = $this -> _cancel_button['nazwa'];
$tpl -> _cancel_key = $this -> _cancel_button['key'];
$tpl -> _cancel_val = $this -> _cancel_button['val'];
}
$tpl -> _table_edit_tab = $table_edit_tab;
$tpl -> _menu = $this -> _menu;
$out .= $tpl -> fetch( 'database/data-edit' );
return $out;
}
}
?>

View File

@@ -0,0 +1,59 @@
<?php
class FileCache
{
public function store( $key, $data, $ttl = 'l', $dir = '' )
{
switch ( $ttl )
{
case 's': $time = 60; break;
case 'n': $time = 60 * 60; break;
case 'l': default: $time = 60 * 60 * 24; break;
}
$h = fopen( self::getFileName( $key, $dir ) , 'w' );
$data = base64_encode( serialize( array( time() + $time , $data ) ) );
@fwrite( $h, $data );
fclose($h);
}
public function getFileName( $key, $dir = '' )
{
$md5 = md5( $key );
if ( !$dir )
$dir = 'temp/' . $md5[0] . '/';
else
$dir = $dir . '/' . $md5[0] . '/';
if ( !is_dir( $dir ) )
mkdir( $dir , 0770 , true );
return $dir . 's_cache' . $md5;
}
public function fetch( $key, $dir = '' )
{
$filename = self::getFileName( $key, $dir );
if ( !file_exists( $filename ) || !is_readable( $filename ) )
return false;
$data = base64_decode( file_get_contents( $filename ) );
$data = @unserialize( $data );
if ( !$data )
{
unlink($filename);
return false;
}
if ( time() > $data[0] )
{
if ( file_exists( $filename ) )
unlink( $filename );
return false;
}
return $data[1];
}
}
?>

View File

@@ -0,0 +1,316 @@
<?php
class GoogleRank {
private $_phrase;
private $_url;
private $_localization;
private $_results;
private $_num;
private $_start;
private $_i;
function __construct( $_phrase, $_url, $_localization, $_num = 10, $_start = 0, $_i )
{
$this -> _phrase = $_phrase;
$this -> _url = $_url;
$this -> _localization = $_localization;
$this -> _num = $_num;
$this -> _start = $_start;
$this -> _i = $_i;
}
public static function uule( $city )
{
$secretkey = array_merge(range('A','Z'), range('a','z'), range('0','9'), array('-', '_'));
return trim('w+CAIQICI'.$secretkey[strlen($city)%count($secretkey)].base64_encode($city), '=');
}
public function getRankProxy()
{
global $db, $mdb, $mdb_2;
$headers = [
'Accept-Language: pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7',
'Pragma: no-cache',
'Cache-control: no-cache',
'Upgrade-insecure-requests: 1',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'
];
$results = $mdb_2 -> query( 'SELECT '
. 'id, proxy, bg '
. 'FROM '
. 'pro_proxy_servers '
. 'WHERE '
. 'enabled = 1 '
. 'AND '
. '( bgd < NOW() OR bgd IS NULL ) '
. 'ORDER BY '
. 'used ASC '
. 'LIMIT 1' ) -> fetchAll();
if ( is_array( $results ) and !empty( $results ) )
{
foreach ( $results as $row )
{
$google = 'phrase=' . trim( $this -> _phrase ) . '&num=' . $this -> _num . '&start=' . $this -> _start;
$curl = curl_init();
curl_setopt( $curl, CURLOPT_URL, $row['proxy'] );
curl_setopt( $curl, CURLOPT_POST, true );
curl_setopt( $curl, CURLOPT_POSTFIELDS, 'action=check_rank&' . $google . '&localization=' . trim( $this -> _localization ) );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0' );
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt( $curl, CURLOPT_TIMEOUT, 10 );
curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers );
curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $curl, CURLOPT_ENCODING, "gzip,deflate" );
$result = curl_exec( $curl );
$speed = curl_getinfo( $curl, CURLINFO_TOTAL_TIME );
$retcode = curl_getinfo( $curl, CURLINFO_HTTP_CODE );
curl_close( $curl );
if ( !$result or $retcode == 404 )
{
$mdb_2 -> query( 'UPDATE pro_proxy_servers SET used = NOW(), bg = ' . ( $row['bg'] + 1 ) . ', bgd = DATE_ADD( NOW(), INTERVAL ( bg + 1 ) * 15 MINUTE ) WHERE id = ' . $row['id'] );
return -1;
}
if (
strpos( $result, 'Google' ) == false
or
strpos( $result, 'Our systems have detected unusual traffic' ) !== false
or
strpos( $result, 'Forbidden' ) !== false
or
strpos( $result, 'Aby kontynuowa' ) !== false
or
strpos( $result, 'Our systems have detected unusual traffic' ) !== false
or
strpos( $result, 'sending automated queries' ) !== false
or
strpos( $result, 'That’s an error' ) !== false
or
strpos( $result, 'Nasze systemy wykryĹy nietypowy ruch pochodzÄ…cy z Twojej siec' ) !== false
)
{
$mdb_2 -> query( 'UPDATE pro_proxy_servers SET used = NOW(), bg = ' . ( $row['bg'] + 1 ) . ', bgd = DATE_ADD( NOW(), INTERVAL ( bg + 1 ) * 15 MINUTE ), speed = \'' . $speed . '\' WHERE id = ' . $row['id'] );
return -1;
}
$mdb_2 -> query( 'UPDATE pro_proxy_servers SET used = NOW(), bg = 0, speed = \'' . $speed . '\' WHERE id = ' . $row['id'] );
}
}
else
{
$results2 = $mdb -> query( 'SELECT '
. 'id, proxy, userpasswd '
. 'FROM '
. 'pro_proxy '
. 'WHERE '
. 'is_banned = 0 '
. 'ORDER BY '
. 'last_used ASC '
. 'LIMIT 1' ) -> fetchAll();
if ( is_array( $results2 ) and !empty( $results2 ) ) {
foreach ( $results2 as $row ) {
$google = 'phrase=' . trim( $this -> _phrase ) . '&num=' . $this -> _num . '&start=' . $this -> _start;
$curl = curl_init();
curl_setopt( $curl, CURLOPT_URL, 'http://www.rank24.pl/monitoring.php' );
curl_setopt( $curl, CURLOPT_POST, true );
curl_setopt( $curl, CURLOPT_POSTFIELDS, 'action=check_rank&' . $google . '&localization=' . trim( $this -> _localization ) . '&proxy=' . $row['proxy'] . '&userpasswd=' . $row['userpasswd'] );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0' );
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt( $curl, CURLOPT_TIMEOUT, 10 );
curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers );
curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $curl, CURLOPT_ENCODING, "gzip,deflate" );
$result = curl_exec( $curl );
$speed = curl_getinfo( $curl, CURLINFO_TOTAL_TIME );
$retcode = curl_getinfo( $curl, CURLINFO_HTTP_CODE );
curl_close( $curl );
if ( !$result or $retcode == 404 )
{
$mdb -> query( 'UPDATE pro_proxy SET last_used = NOW(), is_banned = 1, banned_count = ' . ( $row['banned_count'] + 1 ) . ', banned_date = DATE_ADD( NOW(), INTERVAL ( banned_count + 1 ) * 15 MINUTE ) WHERE id = ' . $row['id'] );
return -1;
}
if (
strpos( $result, 'Google' ) == false
or
strpos( $result, 'Our systems have detected unusual traffic' ) !== false
or
strpos( $result, 'Forbidden' ) !== false
or
strpos( $result, 'Aby kontynuowa' ) !== false
or
strpos( $result, 'Our systems have detected unusual traffic' ) !== false
or
strpos( $result, 'sending automated queries' ) !== false
or
strpos( $result, 'That’s an error' ) !== false
or
strpos( $result, 'Nasze systemy wykryĹy nietypowy ruch pochodzÄ…cy z Twojej siec' ) !== false
)
{
$mdb -> query( 'UPDATE pro_proxy SET last_used = NOW(), is_banned = 1, banned_count = ' . ( $row['banned_count'] + 1 ) . ', banned_date = DATE_ADD( NOW(), INTERVAL ( banned_count + 1 ) * 15 MINUTE ) WHERE id = ' . $row['id'] );
return -1;
}
$mdb -> query( 'UPDATE pro_proxy SET last_used = NOW(), is_banned = 0 WHERE id = ' . $row['id'] );
}
} else
return -1;
}
$this -> _results = self::parse_urls( $result );
$site_details = $this -> searchUrl();
return $site_details;
}
public static function parse_urls( $result, $zennoposter = false )
{
$results = array();
$doc = new DOMDocument();
$doc -> loadHTML( $result );
$div = $doc -> getElementById( 'res' );
/* do sprawdzenia */
if ( $div == null )
{
file_put_contents( 'google-rank.txt', $result );
return false;
}
$div_g_array = $div -> getElementsByTagName( 'div' );
foreach ( $div_g_array as $div_a )
{
if ( $div_a -> getAttribute( 'class' ) == 'g' or $div_a -> getAttribute( 'class' ) == '_gt' or $div_a -> getAttribute( 'class' ) == 'g mnr-c g-blk' or strpos( $div_a -> getAttribute( 'class' ), 'uMdZh' ) !== false )
{
if ( $div_a -> getAttribute( 'class' ) == 'g' or $div_a -> getAttribute( 'class' ) == 'g mnr-c g-blk' )
{
$div2_a = $div_a -> getElementsByTagName( 'div' );
foreach ( $div2_a as $div2 )
{
if ( $div2 -> getAttribute( 'class' ) == 'r' )
{
$a_a = $div2 -> getElementsByTagName( 'a' );
foreach ( $a_a as $a )
{
if ( $a -> getAttribute( 'class' ) == '' )
{
unset( $row );
$row['type'] = 'organic';
$row['href'] = $a -> getAttribute( 'href' );
$results[] = $row;
}
}
}
}
}
else if ( $div_a -> getAttribute( 'class' ) == '_gt' )
{
$a_a = $div_a -> getElementsByTagName( 'a' );
foreach ( $a_a as $a )
{
if ( strpos( $a -> getAttribute( 'class' ), '_Jrh' ) !== false )
{
unset( $row );
$row['type'] = 'map';
$row['href'] = $a -> getAttribute( 'href' );
$results[] = $row;
}
}
}
if ( strpos( $div_a -> getAttribute( 'class' ), 'uMdZh' ) !== false )
{
$a_a = $div_a -> getElementsByTagName( 'a' );
foreach ( $a_a as $a )
{
if ( strpos( $a -> getAttribute( 'class' ), 'L48Cpd' ) !== false )
{
unset( $row );
$row['type'] = 'map';
$row['href'] = $a -> getAttribute( 'href' );
$results[] = $row;
}
}
}
}
}
// \S::pre( $results ); exit;
return $results;
}
function searchUrl()
{
$site_details = array();
$i = $this -> _i;
if ( is_array( $this -> _results ) ) foreach ( $this -> _results as $res )
{
if ( self::getHost( $res['href'] ) == self::getHost( 'http://' . $this -> _url ) && !$site_details['position'] )
{
$site_details['url'] = $res['href'];
if ( $res['type'] == 'map' )
$site_details['map'] = true;
else
$site_details['map'] = false;
$site_details['position'] = $i;
}
$i++;
}
if ( !$site_details['map'] )
{
$i = $this -> _i;
$site_details['position'] = 0;
if ( is_array( $this -> _results ) ) foreach ( $this -> _results as $res )
{
if ( self::getHost( $res['href'] ) == self::getHost( 'http://' . $this -> _url ) && !$site_details['position'] )
{
$site_details['href'] = $res['href'];
$site_details['map'] = false;
$site_details['position'] = $i;
}
if ( $res['type'] != 'map' )
$i++;
}
}
return $site_details;
}
function deleteMapFromResults()
{
if ( is_array( $this -> _results ) ) foreach ( $this -> _results as $res )
{
if ( $res['type'] == 'organic' )
$results_tmp[] = $res;
}
$this -> _results = $results_tmp;
}
function getHost( $page )
{
$page = parse_url( $page, PHP_URL_HOST );
$page = str_replace( "www.", "", $page );
return $page;
}
}
?>

View File

@@ -0,0 +1,70 @@
<?php
class GoogleScraper {
var $_header = array(
'Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/29.0',
'Mozilla/5.0 (X11; OpenBSD amd64; rv:28.0) Gecko/20100101 Firefox/28.0',
'Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0',
'Mozilla/5.0 (Windows NT 6.1; rv:27.3) Gecko/20130101 Firefox/27.3',
'Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:27.0) Gecko/20121011 Firefox/27.0',
'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/535.7 (KHTML, like Gecko) Comodo_Dragon/16.1.1.0 Chrome/16.0.912.63 Safari/535.7',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Comodo_Dragon/12.1.0.0 Chrome/12.0.742.91 Safari/534.30',
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Comodo_Dragon/12.1.0.0 Chrome/12.0.742.91 Safari/534.30',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1250.0 Iron/22.0.2150.0 Safari/537.4',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1250.0 Iron/22.0.2150.0 Safari/537.4',
'Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0',
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)',
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)',
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)',
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/4.0; GTB7.4; InfoPath.3; SV1; .NET CLR 3.1.76908; WOW64; en-US)',
'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20121202 Firefox/17.0 Iceweasel/17.0.1',
'Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1 Iceweasel/15.0.1',
'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'
);
var $_cookie = '';
function __construct( $url, $proxy, $cookie = '' )
{
$this -> _url = $url;
$this -> _cookie = $cookie;
}
function getpagedata( $url )
{
$header = $this -> _header[ rand( 0, count( $this -> _header ) - 1 ) ];
$ch = curl_init();
curl_setopt( $ch, CURLOPT_HEADER, false );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_REFERER, 'www.google.pl' );
curl_setopt( $ch, CURLOPT_USERAGENT, $header );
curl_setopt( $ch, CURLOPT_PROXY, $this -> _proxy );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt( $ch, CURLOPT_TIMEOUT, 10 );
curl_setopt( $ch, CURLOPT_COOKIE, $this -> _cookie );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 5 );
curl_setopt( $ch, CURLOPT_ENCODING, "gzip,deflate" );
$data = curl_exec( $ch );
curl_close( $ch );
return $data;
}
function pause()
{
usleep( rand( $this -> _time1, $this -> _time2 ) );
}
function initGoogle()
{
return $this -> getpagedata( $this -> _url );
return $google;
}
}

View File

@@ -0,0 +1,314 @@
<?php
class GoogleSite {
const G_PATTERN = '/<a href="\/url\?q=([^"]+)"/';
public function checkProxyServerVersion( $proxy )
{
$curl = curl_init();
curl_setopt( $curl, CURLOPT_URL, $proxy . '?action=check_version' );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $curl, CURLOPT_VERBOSE, 1 );
curl_setopt( $curl, CURLOPT_TIMEOUT, 15 );
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 15 );
curl_setopt( $curl, CURLOPT_ENCODING, "gzip,deflate" );
$out['result'] = curl_exec( $curl );
$out['code'] = curl_getinfo( $curl, CURLINFO_HTTP_CODE );
$out['info'] = curl_getinfo( $curl );
curl_close( $curl );
return $out;
}
public function checkProxyServer( $proxy )
{
$curl = curl_init();
curl_setopt( $curl , CURLOPT_URL , $proxy );
curl_setopt( $curl , CURLOPT_POST , 1 );
curl_setopt( $curl , CURLOPT_POSTFIELDS , 'action=check_site&url=onet.pl' );
curl_setopt( $curl , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt( $curl, CURLOPT_ENCODING, "gzip,deflate" );
$site = curl_exec( $curl );
curl_close( $curl );
return $site;
}
public function checkProxy( $proxy )
{
$curl = curl_init();
curl_setopt( $curl , CURLOPT_HEADER , 1 );
curl_setopt( $curl , CURLOPT_USERAGENT , "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12" );
curl_setopt( $curl , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt( $curl , CURLOPT_VERBOSE , 1 );
curl_setopt( $curl , CURLOPT_REFERER , 'http://www.google.pl' );
curl_setopt( $curl , CURLOPT_CONNECTTIMEOUT, 5 );
curl_setopt( $curl , CURLOPT_TIMEOUT , 5 );
curl_setopt( $curl , CURLOPT_PROXY, $proxy );
curl_setopt( $curl , CURLOPT_URL , 'http://www.google.pl/search?q=site:' . urlencode( 'onet.pl' ) . '&num=10&start=0&hl=pl' );
curl_setopt( $curl, CURLOPT_ENCODING, "gzip,deflate" );
$google = \S::curl_redir_exec( $curl );
curl_close( $curl );
if ( !$google )
return -1;
if ( strpos( $google, 'onet.pl' ) === false )
return -1;
if (
strpos( $google, 'Aby kontynuować' ) !== false ||
strpos( $google , 'Our systems have detected unusual traffic' ) !== false ||
strpos( $google , 'sending automated queries' ) !== false )
return -2;
if ( strpos( $google, 'onet.pl' ) !== false )
{
if ( strpos( $google, 'nie została odnaleziona.' ) !== false )
return 0;
preg_match_all( $pattern , $google , $google );
$google = array_pop( $google );
if ( isset( $google[0] ) )
preg_match_all( $pattern2 , $google[0] , $google );
else
return 0;
$google = array_pop( $google );
$google = str_replace( ',' , '' , $google[0] );
return $google;
}
}
public function getSite( $url, $debug = false )
{
global $db;
$site = -1;
$query = $db -> query( 'SELECT id, proxy, user_id FROM pro_proxy_servers WHERE enabled = 1 AND bg < NOW() ORDER BY used ASC LIMIT 1' );
if ( $query -> rowCount() )
{
while ( $row = $query -> fetch() )
{
$curl = curl_init();
curl_setopt( $curl , CURLOPT_URL , $row['proxy'] );
curl_setopt( $curl , CURLOPT_POST , 1 );
curl_setopt( $curl , CURLOPT_POSTFIELDS , 'action=check_site&url=' . $url );
curl_setopt( $curl , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt( $curl, CURLOPT_ENCODING, "gzip,deflate" );
$site = curl_exec( $curl );
curl_close( $curl );
if ( $debug )
{
$data = file_get_contents( 'data/gs-' . date( 'Y-m-d' ) . '.txt' );
$data = $row['proxy'] . ' - ' . $site . ' - ' . $url . chr( 13 ) . chr( 10 ) . $data;
file_put_contents( 'data/gs-' . date( 'Y-m-d' ) . '.txt', $data );
}
if ( $site == -1 )
$db -> query( 'UPDATE pro_proxy_servers SET used = NOW(), bgd = DATE_ADD( NOW(), INTERVAL 1 HOUR ) WHERE id = ' . $row['id'] );
else
$db -> query( 'UPDATE pro_proxy_servers SET used = NOW() WHERE id = ' . $row['id'] );
}
}
$query -> closeCursor();
return $site;
}
public function getSitesByKeywords( $phrase )
{
global $db;
$query = $db -> query( 'SELECT id, proxy, bg FROM pro_proxy_servers WHERE enabled = 1 AND ( bgd < NOW() OR bgd IS NULL ) ORDER BY used ASC LIMIT 1' );
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$curl = curl_init();
curl_setopt( $curl, CURLOPT_URL, $row['proxy'] );
curl_setopt( $curl, CURLOPT_HEADER, false );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_POSTFIELDS, 'action=get_sites&phrase=' . $phrase );
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt( $curl, CURLOPT_TIMEOUT, 10 );
curl_setopt( $curl, CURLOPT_ENCODING, "gzip,deflate" );
$result = curl_exec( $curl );
if ( !$result )
{
$db -> query( 'UPDATE pro_proxy_servers SET used = NOW(), bg = ' . ( $row['bg'] + 1 ) . ', bgd = DATE_ADD( NOW(), INTERVAL ' . ( $row['bg'] + 1 ) * 15 . ' MINUTE ) WHERE id = ' . $row['id'] );
return -1;
}
if (
strpos( $result, 'Our systems have detected unusual traffic' ) !== false
or
strpos( $result, 'Aby kontynuowa' ) !== false
or
strpos( $result, 'Our systems have detected unusual traffic' ) !== false
or
strpos( $result, 'sending automated queries' ) !== false
or
strpos( $result, 'Thats an error' ) !== false
)
{
$db -> query( 'UPDATE pro_proxy_servers SET used = NOW(), bg = ' . ( $row['bg'] + 1 ) . ', bgd = DATE_ADD( NOW(), INTERVAL ' . ( $row['bg'] + 1 ) * 15 . ' MINUTE ) WHERE id = ' . $row['id'] );
return -1;
}
$db -> query( 'UPDATE pro_proxy_servers SET used = NOW(), bg = 0 WHERE id = ' . $row['id'] );
}
else
return -1;
if ( strpos( $result, $phrase ) !== false )
{
$results = self::parse_urls( $result );
foreach ( $results as $link )
$sites .= $link['href'] . '|||';
}
if ( !$sites )
return -1;
return $sites;
}
public static function parse_urls( $result )
{
$results = array();
$doc = new DOMDocument();
$doc -> loadHTML( $result );
$div = $doc -> getElementById( 'res' );
$ol_a = $div -> getElementsByTagName( 'ol' );
foreach ( $ol_a as $ol )
{
foreach ( $ol -> childNodes as $div )
{
if ( $div -> tagName == 'div' and $div -> getAttribute( 'class' ) != '' )
{
$a_a = $div -> getElementsByTagName( 'a' );
foreach ( $a_a as $a )
{
if ( strpos( $a -> getAttribute( 'class' ), 'rllt__action' ) !== false and $a -> getAttribute( 'onmousedown' ) != '' )
{
unset( $row );
$row['type'] = 'map';
$row['href'] = $a -> getAttribute( 'href' );
$results[] = $row;
}
else if ( $a -> getAttribute( 'onmousedown' ) != '' and $a -> getAttribute( 'class' ) == '' )
{
unset( $row );
$row['type'] = 'organic';
$row['href'] = $a -> getAttribute( 'href' );
$results[] = $row;
}
}
}
}
}
if ( empty( $results ) )
{
$doc = new DOMDocument();
$doc -> loadHTML( $result );
$div = $doc -> getElementById( 'res' );
$ol_a = $div -> getElementsByTagName( 'ol' );
foreach ( $ol_a as $ol )
{
$h3_a = $ol -> getElementsByTagName( 'h3' );
foreach ( $h3_a as $h3 )
{
$a_a = $h3 -> getElementsByTagName( 'a' );
foreach ( $a_a as $a )
{
if ( $a -> getAttribute( 'class' ) == 'l' and $a -> getAttribute( 'onmousedown' ) != '' )
{
unset( $row );
$row['type'] = 'map';
$row['href'] = $a -> getAttribute( 'href' );
$results[] = $row;
}
if ( $a -> getAttribute( 'class' ) == '' and $a -> getAttribute( 'onmousedown' ) != '' )
{
unset( $row );
$row['type'] = 'organic';
$row['href'] = $a -> getAttribute( 'href' );
$results[] = $row;
}
}
}
}
}
/* 12.02.2016 */
if ( empty( $results ) )
{
$doc = new DOMDocument();
$doc -> loadHTML( $result );
$div = $doc -> getElementById( 'res' );
$div_g_array = $div -> getElementsByTagName( 'div' );
foreach ( $div_g_array as $div_a )
{
if ( $div_a -> getAttribute( 'class' ) == 'g' or $div_a -> getAttribute( 'class' ) == '_gt' )
{
if ( $div_a -> getAttribute( 'class' ) == 'g' )
{
$h3_a = $div_a -> getElementsByTagName( 'h3' );
foreach ( $h3_a as $h3 )
{
$a_a = $h3 -> getElementsByTagName( 'a' );
foreach ( $a_a as $a )
{
if ( $a -> getAttribute( 'class' ) == '' and $a -> getAttribute( 'onmousedown' ) != '' )
{
unset( $row );
$row['type'] = 'organic';
$row['href'] = $a -> getAttribute( 'href' );
$results[] = $row;
}
}
}
}
else if ( $div_a -> getAttribute( 'class' ) == '_gt' )
{
$a_a = $div_a -> getElementsByTagName( 'a' );
foreach ( $a_a as $a )
{
if ( $a -> getAttribute( 'class' ) == 'rllt__action-button _Jrh' and $a -> getAttribute( 'onmousedown' ) != '' )
{
unset( $row );
$row['type'] = 'map';
$row['href'] = $a -> getAttribute( 'href' );
$results[] = $row;
}
}
}
}
}
}
return $results;
}
}
?>

90
autoload/class.Html.php Normal file
View File

@@ -0,0 +1,90 @@
<?php
class Html
{
public static function form_text( array $params = array() )
{
$tpl = new \Tpl;
$tpl -> params = $params;
return $tpl -> render( 'html/form-text' );
}
public static function input_switch( array $params = array() )
{
$tpl = new \Tpl;
$tpl -> params = $params;
return $tpl -> render( 'html/input-switch' );
}
public static function select( array $params = array() )
{
$tpl = new \Tpl;
$tpl -> params = $params;
return $tpl -> render( 'html/select' );
}
public static function textarea( array $params = array() )
{
$defaults = array(
'rows' => 4,
);
$params = array_merge( $defaults, $params );
$tpl = new \Tpl;
$tpl -> params = $params;
return $tpl -> render( 'html/textarea' );
}
public static function input_icon( array $params = array() )
{
$defaults = array(
'type' => 'text',
);
$params = array_merge( $defaults, $params );
$tpl = new \Tpl;
$tpl -> params = $params;
return $tpl -> render( 'html/input-icon' );
}
public static function input( array $params = array() )
{
$defaults = array(
'type' => 'text',
);
$params = array_merge( $defaults, $params );
$tpl = new \Tpl;
$tpl -> params = $params;
return $tpl -> render( 'html/input' );
}
public static function button( array $params = array() ) {
$defaults = array(
'class' => 'btn-sm btn-info',
);
$params = array_merge( $defaults, $params );
$tpl = new \Tpl;
$tpl -> params = $params;
return $tpl -> render( 'html/button' );
}
public static function panel( array $params = array() )
{
$defaults = array(
'title' => 'panel-title',
'class' => 'panel-primary',
'content' => 'panel-content'
);
$params = array_merge( $defaults, $params );
$tpl = new \Tpl;
$tpl -> params = $params;
return $tpl -> render( 'html/panel' );
}
}

36
autoload/class.Paging.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
class Paging {
public $_ls;
public $_bs;
public $_limit;
public $_count;
public $_start;
public $_end;
public $_link;
function __construct( $ls, $bs, $limit, $count, $link )
{
$this -> _ls = $ls;
$this -> _bs = $bs;
$this -> _limit = $limit;
$this -> _count = $count;
$this -> _start = ( $bs - 1 ) * $limit + 1;
$this -> _end = $bs * $limit;
$this -> _link = $link;
}
public function draw()
{
$tpl = new \Savant3;
$tpl -> _ls = $this -> _ls;
$tpl -> _bs = $this -> _bs;
$tpl -> _limit = $this -> _limit;
$tpl -> _count = $this -> _count;
$tpl -> _start = $this -> _start;
$tpl -> _end = $this -> _end;
$tpl -> _link = $this -> _link;
return $tpl -> fetch( 'other/pager' );
}
}
?>

709
autoload/class.S.php Normal file
View File

@@ -0,0 +1,709 @@
<?php
class S
{
public static function parse_csv($csv_string, $delimiter = ",", $skip_empty_lines = true, $trim_fields = true)
{
return array_map(
function ($line) use ($delimiter, $trim_fields)
{
return array_map(
function ($field)
{
return str_replace('!!Q!!', '"', utf8_decode(urldecode($field)));
},
$trim_fields ? array_map('trim', explode($delimiter, $line)) : explode(
$delimiter,
$line
)
);
},
preg_split(
$skip_empty_lines ? ($trim_fields ? '/( *\R)+/s' : '/\R+/s') : '/\R/s',
preg_replace_callback(
'/"(.*?)"/s',
function ($field)
{
return urlencode(utf8_encode($field[1]));
},
$enc = preg_replace('/(?<!")""/', '!!Q!!', $csv_string)
)
)
);
}
public static function generateRandomString($length = 5)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++)
{
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
public static function get_domain($url)
{
$url = parse_url($url, PHP_URL_HOST);
$url = str_replace("www.", "", $url);
return $url;
}
public static function array_sort_by_column(&$arr, $col, $dir = SORT_ASC)
{
$sort_col = array();
foreach ($arr as $key => $row)
{
$sort_col[$key] = $row[$col];
}
array_multisort($sort_col, $dir, $arr);
}
function getUrlData($url)
{
$result = false;
$contents = \S::getUrlContents($url);
if (isset($contents) && is_string($contents))
{
$title = null;
$metaTags = null;
preg_match('/<title>([^>]*)<\/title>/si', $contents, $match);
if (isset($match) && is_array($match) && count($match) > 0)
{
$title = strip_tags($match[1]);
}
preg_match_all('/<[\s]*meta[\s]*name="?' . '([^>"]*)"?[\s]*' . 'content="?([^>"]*)"?[\s]*[\/]?[\s]*>/si', $contents, $match);
if (isset($match) && is_array($match) && count($match) == 3)
{
$originals = $match[0];
$names = $match[1];
$values = $match[2];
if (count($originals) == count($names) && count($names) == count($values))
{
$metaTags = array();
for ($i = 0, $limiti = count($names); $i < $limiti; $i++)
{
$metaTags[$names[$i]] = array(
'html' => htmlentities($originals[$i]),
'value' => $values[$i]
);
}
}
}
$result = array(
'title' => $title,
'metaTags' => $metaTags
);
}
return $result;
}
function getUrlContents($url, $maximumRedirections = 1, $currentRedirection = 0)
{
$result = false;
$contents = @file_get_contents($url);
// Check if we need to go somewhere else
if (isset($contents) && is_string($contents))
{
preg_match_all('/<[\s]*meta[\s]*http-equiv="?REFRESH"?' . '[\s]*content="?[0-9]*;[\s]*URL[\s]*=[\s]*([^>"]*)"?' . '[\s]*[\/]?[\s]*>/si', $contents, $match);
if (isset($match) && is_array($match) && count($match) == 2 && count($match[1]) == 1)
{
if (!isset($maximumRedirections) || $currentRedirection < $maximumRedirections)
{
return self::getUrlContents($match[1][0], $maximumRedirections, ++$currentRedirection);
}
$result = false;
}
else
{
$result = $contents;
}
}
return $contents;
}
public function getMonthNames()
{
return array(1 => 'Styczeń', 2 => 'Luty', 3 => 'Marzec', 4 => 'Kwiecień', 5 => 'Maj', 6 => 'Czerwiec', 7 => 'Lipiec', 8 => 'Sierpień', 9 => 'Wrzesień', 10 => 'Październik', 11 => 'Listopad', 12 => 'Grudzień');
}
function getAddresses($domain)
{
$records = dns_get_record($domain);
$res = array();
foreach ($records as $r)
{
if ($r['host'] != $domain) continue; // glue entry
if (!isset($r['type'])) continue; // DNSSec
if ($r['type'] == 'A') $res[] = $r['ip'];
if ($r['type'] == 'AAAA') $res[] = $r['ipv6'];
}
return $res;
}
public static function number($value)
{
return number_format($value, 2, '.', '');
}
public function number_display($value)
{
return number_format($value, 2, ',', ' ') . ' zł';
}
public function downloadFile($file)
{
if (file_exists($file) && is_readable($file))
{
$name = str_replace('temp/', '', $file);
$name = str_replace('temp_t/', '', $name);
header('Content-type: application/pdf');
header("Content-Disposition: attachment; filename=\"" . $name . "\"");
readfile($file);
}
exit;
}
function d2w($digits)
{
if ($digits * 1 == 0)
{
return "zero";
}
$jednosci = array('zero', 'jeden', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć', 'siedem', 'osiem', 'dziewięć');
$dziesiatki = array('', 'dziesięć', 'dwadzieścia', 'trzydzieści', 'czterdzieści', 'piećdziesiąt', 'sześćdziesiąt', 'siedemdziesiąt', 'osiemdziesiąt', 'dziewiećdziesiąt');
$setki = array('', 'sto', 'dwieście', 'trzysta', 'czterysta', 'pięćset', 'sześćset', 'siedemset', 'osiemset', 'dziewięćset');
$nastki = array('dziesięć', 'jedenaście', 'dwanaście', 'trzynaście', 'czternaście', 'piętnaście', 'szesnaście', 'siedemnaście', 'osiemnaście', 'dzięwietnaście');
$tysiace = array('tysiąc', 'tysiące', 'tysięcy');
$digits = (string) $digits;
$digits = strrev($digits);
$i = strlen($digits);
$string = '';
if ($i > 5 && $digits[5] > 0)
{
$string .= $setki[$digits[5]] . ' ';
}
if ($i > 4 && $digits[4] > 1)
{
$string .= $dziesiatki[$digits[4]] . ' ';
}
else if ($i > 3 && $digits[4] == 1)
{
$string .= $nastki[$digits[3]] . ' ';
}
if ($i > 3 && $digits[3] > 0 && $digits[4] != 1)
{
$string .= $jednosci[$digits[3]] . ' ';
}
$tmpStr = substr(strrev($digits), 0, -3);
if (strlen($tmpStr) > 0)
{
$tmpInt = (int) $tmpStr;
if ($tmpInt == 1)
{
$string .= $tysiace[0] . ' ';
}
elseif (($tmpInt % 10 > 1 && $tmpInt % 10 < 5) && ($tmpInt < 10 || $tmpInt > 20))
{
$string .= $tysiace[1] . ' ';
}
else
{
$string .= $tysiace[2] . ' ';
}
}
if ($i > 2 && $digits[2] > 0)
{
$string .= $setki[$digits[2]] . ' ';
}
if ($i > 1 && $digits[1] > 1)
{
$string .= $dziesiatki[$digits[1]] . ' ';
}
elseif ($i > 0 && $digits[1] == 1)
{
$string .= $nastki[$digits[0]] . ' ';
}
if ($digits[0] > 0 && $digits[1] != 1)
{
$string .= $jednosci[$digits[0]] . ' ';
}
return $string;
}
function slownie($a, $j1, $j2, $j3)
{
$out = self::d2w($a);
$i = strlen($a);
$l = substr($a, $i - 1);
if ($l == 1)
{
$out .= " $j1";
}
else if ($l == 2 || $l == 3 || $l == 4)
{
$out .= " $j2";
}
else
{
$out .= " $j3";
}
return $out;
}
function SC($a)
{
$a = round($a, 2);
$c = floor($a);
$u = $a - $c;
$us = self::slownie(round($u * 100, 2), "grosz", "grosze", "groszy");
$cs = self::slownie($c, "złoty", "złote", "złotych");
return "$cs, $us";
}
public function sendEmail($email, $temat, $tresc, $replay = '', $file = '')
{
include_once 'resources/phpmailer/class.phpmailer.php';
include_once 'resources/phpmailer/class.smtp.php';
if (isset($email) && isset($temat) && isset($tresc))
{
$admin_mail = 'biuro@project-pro.pl';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = 'mail.project-pro.pl';
$mail->Port = 465;
$mail->Username = 'biuro@project-pro.pl';
$mail->Password = 'Legia1916Warszawa';
$mail->CharSet = "UTF-8";
$mail->SMTPSecure = 'ssl';
$mail->SMTPOptions = [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
];
if ($replay == "")
{
$mail->AddReplyTo($admin_mail, 'Project-Pro Pyziak Jacek');
$mail->SetFrom($admin_mail, 'Project-Pro Pyziak Jacek');
}
else
{
$mail->AddReplyTo($replay, 'Project-Pro Pyziak Jacek');
$mail->SetFrom($replay, 'Project-Pro Pyziak Jacek');
}
$mail->AddAddress($email, '');
$mail->Subject = $temat;
$mail->setLanguage('pl');
$mail->Body = str_replace('<br>', chr(13) . chr(10), $tresc);
if (is_array($file))
{
foreach ($file as $f)
$mail->AddAttachment($f);
}
else if ($file)
$mail->AddAttachment($file);
$mail->IsHTML(true);
return $mail->Send();
}
return false;
}
function curl_redir_exec($ch, $proxy = "")
{
static $curl_loops = 0;
static $curl_max_loops = 20;
if ($curl_loops++ >= $curl_max_loops)
{
$curl_loops = 0;
return FALSE;
}
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($proxy)
{
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
}
$data = curl_exec($ch);
$debbbb = $data;
@list($header, $data) = explode("\n\n", $data, 2);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code == 301 || $http_code == 302)
{
$matches = array();
preg_match('/Location:(.*?)\n/', $header, $matches);
$url = @parse_url(trim(array_pop($matches)));
if (!$url)
{
$curl_loops = 0;
return $data;
}
$last_url = parse_url(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
if (!isset($url['query']))
$url['query'] = '';
if (!isset($url['scheme']))
$url['scheme'] = '';
$new_url = $url['scheme'] . '://' . $url['host'] . $url['path'] . ($url['query'] ? '?' . $url['query'] : '');
curl_setopt($ch, CURLOPT_URL, $new_url);
return self::curl_redir_exec($ch);
}
else
{
$curl_loops = 0;
return $debbbb;
}
}
public function info($text, $print = false)
{
$info = '<p style="font-size: 11px; font-family: Verdana; background: #f6f6f6; border: 1px solid #dddddd; line-height: 30px; padding: 5px 20px;">' . $text . '</p>';
if ($print)
echo $info;
return $info;
}
public function my_array_diff($a, $b)
{
$map = $out = array();
if (is_array($a)) foreach ($a as $val) $map[trim($val)] = 1;
if (is_array($b)) foreach ($b as $val) unset($map[trim($val)]);
return array_keys($map);
}
public function pre($data, $type = '')
{
$data = str_replace('Array
(', '', $data);
$data = str_replace(')', '', $data);
echo '<pre';
if ($type == 'error')
echo ' style="color: #cc0000;" ';
else if ($type == 'info')
echo ' style="color: #2c539e;" ';
else
echo ' style="color: #8fc400;" ';
echo '>' . print_r($data, true) . '</pre>';
}
public function deleteSessionVar($var)
{
unset($_SESSION[$var]);
}
public function deleteCache($str = '../temp/')
{
if (is_file($str))
{
return @unlink($str);
}
else if (is_dir($str))
{
$scan = glob(rtrim($str, '/') . '/*');
if (is_array($scan)) foreach ($scan as $index => $path)
{
\S::deleteCache($path);
}
if ($str != '../temp/' && $str != 'temp/')
return @rmdir($str);
}
}
public function saveString($val, $tolower = false)
{
if ($tolower)
$val = strtolower($val);
return trim(strip_tags($val));
}
public function deleteCacheAdmin($str = 'temp/')
{
if (is_file($str))
{
return @unlink($str);
}
else if (is_dir($str))
{
$scan = glob(rtrim($str, '/') . '/*');
if (is_array($scan)) foreach ($scan as $index => $path)
self::deleteCache($path);
if ($str != 'temp/' && $str != 'admin/temp/')
return @rmdir($str);
}
}
public function getHash($val)
{
$val = base64_encode($val);
$val = \S::get($val);
return base64_decode($val);
}
public function deleteAction()
{
$akcja = "function mycallbackform(v,m,f){
if( v == true )
document.location.href='./?rw=del&amp;id=[param]';
}";
$akcja .= "$.prompt('Potwierdz usunięcie',{ callback: mycallbackform, buttons: { tak: true, nie: false }, focus: 1 })";
$akcja = 'onClick="' . $akcja . '"';
return $akcja;
}
public function seo($val, $nopl = true)
{
$array_rep1 = array('*', '_', ' ', '/', '+', '.', '"', "'", '?', '-', ',', '!', '~', '<', '>', '@', '#', '$', '%', '^', '&', '*' . '(', ')' . '-', '=', '\\', '|', '[', ']', '/', ':');
$array_rep2 = array('-', '-', '-', '-', '-', '-', '', '', '', '-', '-', '', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '', '-', '-', '=', '-', '-', '-', '-');
if ($nopl)
$val = self::noPl($val);
$val = str_replace($array_rep1, $array_rep2, $val);
return strtolower(trim($val));
}
public function noPL($val)
{
$table = array(
//WIN
"\xb9" => "a", "\xa5" => "A", "\xe6" => "c", "\xc6" => "C",
"\xea" => "e", "\xca" => "E", "\xb3" => "l", "\xa3" => "L",
"\xf3" => "o", "\xd3" => "O", "\x9c" => "s", "\x8c" => "S",
"\x9f" => "z", "\xaf" => "Z", "\xbf" => "z", "\xac" => "Z",
"\xf1" => "n", "\xd1" => "N",
//UTF
"\xc4\x85" => "a", "\xc4\x84" => "A", "\xc4\x87" => "c", "\xc4\x86" => "C",
"\xc4\x99" => "e", "\xc4\x98" => "E", "\xc5\x82" => "l", "\xc5\x81" => "L",
"\xc3\xb3" => "o", "\xc3\x93" => "O", "\xc5\x9b" => "s", "\xc5\x9a" => "S",
"\xc5\xbc" => "z", "\xc5\xbb" => "Z", "\xc5\xba" => "z", "\xc5\xb9" => "Z",
"\xc5\x84" => "n", "\xc5\x83" => "N",
//ISO
"\xb1" => "a", "\xa1" => "A", "\xe6" => "c", "\xc6" => "C",
"\xea" => "e", "\xca" => "E", "\xb3" => "l", "\xa3" => "L",
"\xf3" => "o", "\xd3" => "O", "\xb6" => "s", "\xa6" => "S",
"\xbc" => "z", "\xac" => "Z", "\xbf" => "z", "\xaf" => "Z",
"\xf1" => "n", "\xd1" => "N"
);
$array_de = array('Ü');
$array_de_pl = array('U');
$val = str_replace($array_de, $array_de_pl, $val);
$array_uk = array('А', 'а', 'Б', 'б', 'В', 'в', 'Г', 'г', 'ґ', 'Д', 'д', 'Е', 'е', 'Є', 'є', 'Ж', 'ж', 'З' . 'з', 'И', 'и', 'І', 'і', 'Ї', 'ї', 'Й', 'й', 'К', 'к', 'Л', 'л', 'М', 'м', 'Н', 'н', 'О', 'о', 'П', 'п', 'Р', 'р', 'С', 'с', 'Т', 'т', 'У', 'у', 'Ф', 'ф', 'Х', 'х', 'Ц' - 'ц', 'Ч', 'ч', 'Ш', 'ш', 'Щ', 'щ', 'Ю', 'ю', 'Я', 'я', 'ь');
$array_uk_pl = array('А', 'a', 'B', 'b', 'V', 'v', 'Gg', 'gh', 'Gg', 'D', 'd', 'E', 'e', 'Ye', 'yr', 'Zh', 'zh', 'Z', 'z', 'Y', 'y', 'I', 'i', 'Yi', 'yi', 'J', 'j', 'K', 'k', 'L', 'l', 'M', 'm', 'N', 'n', 'O', 'o', 'P', 'p', 'R', 'r', 'S', 's', 'T', 't', 'U', 'u', 'F', 'f', 'Kh', 'kh', 'Ts', 'ts', 'Ch', 'ch', 'Sh', 'sh', 'Shch', 'shch', 'Yu', 'yu', 'Ya', 'ya', '');
$val = str_replace($array_uk, $array_uk_pl, $val);
return strtr($val, $table);
}
public function getDateDiff($data1, $data2, $rodz = '60')
{
$d1_t = explode(' ', $data1);
$d1_tt = explode('-', $d1_t[0]);
$rok1 = $d1_tt[0];
$mc1 = $d1_tt[1];
$d1 = $d1_tt[2];
$d1_tt = explode(':', $d1_t[1]);
$g1 = $d1_tt[0];
$m1 = $d1_tt[1];
$s1 = $d1_tt[2];
$d2_t = explode(' ', $data2);
$d2_tt = explode('-', $d2_t[0]);
$rok2 = $d2_tt[0];
$mc2 = $d2_tt[1];
$d2 = $d2_tt[2];
$d2_tt = explode(':', $d2_t[1]);
$g2 = $d2_tt[0];
$m2 = $d2_tt[1];
$s2 = $d2_tt[2];
$lt = mktime($g2, $m2, $s2, $mc2, $d2, $rok2);
$st = mktime($g1, $m1, $s1, $mc1, $d1, $rok1);
return round(($lt - $st) / $rodz);
}
public function parseRSS($xml, $cat_id)
{
$cnt = count($xml->channel->item);
for ($i = 0; $i < $cnt; $i++)
{
$row['link'] = $xml->channel->item[$i]->link;
$row['date'] = $xml->channel->item[$i]->pubDate;
$row['title'] = $xml->channel->item[$i]->title;
$row['cat_id'] = $cat_id;
$links[] = $row;
}
return $links;
}
public function synonyms($word)
{
global $db, $cache, $config;
if (!$word)
return $word;
$key = 'synonyms:' . $word;
if (!$synonim = $cache->fetch($key, 'temp_t'))
{
$query = $db->prepare('SELECT synonim FROM pro_thesaurus WHERE synonim LIKE "%;' . addslashes($word) . ';%" ORDER BY LENGTH(synonim) DESC LIMIT 1');
$query->execute();
if ($query->rowCount())
{
while ($row = $query->fetch())
$synonim = $row['synonim'];
$synonim = substr($synonim, 1);
$synonim = substr($synonim, 0, -1);
}
else
$synonim = $word;
$query->closeCursor();
if (strpos($synonim, ';') !== false)
$synonim = '{' . str_replace(';', '|', $synonim) . '}';
$cache->store($key, $synonim, $config['cxll'], 'temp_t');
}
return $synonim;
}
public function getHost($page, $www = false)
{
$page = str_replace('https://', 'http://', $page);
preg_match('@^(?:http://)?([^/]+)@i', $page, $matches);
if (!$www)
$matches[1] = str_replace("www.", "", $matches[1]);
return $matches[1];
}
public function preparRequest($query)
{
if (is_array($query) && !empty($query))
{
foreach ($query as $key => $value)
$query[$key] = urlencode($key) . '=' . urlencode($value);
return implode('&', $query);
}
else
return false;
}
public function getDate()
{
return date('Y-m-d H:i:s');
}
public function getComboYesNo()
{
global $lang;
$tab[0] = 'nie';
$tab[1] = 'tak';
return $tab;
}
public function getPagingVar($var, $bs, $ls)
{
if ($var == 'a')
{
if ($bs == 1)
return 6;
else if ($bs == 2)
return 5;
else if ($bs == 3)
return 4;
else
return 3;
}
else if ($var == 'b')
{
if ($bs == $ls)
return 6;
else if ($bs == $ls - 1)
return 5;
else if ($bs == $ls - 2)
return 4;
else
return 3;
}
}
public static function alert($val)
{
\S::set_session('alert', $val);
}
public static function get($var)
{
if (isset($_POST[$var]))
{
if (is_string($_POST[$var]))
return trim($_POST[$var]);
else
return $_POST[$var];
}
else
{
if (isset($_GET[$var]))
{
if (is_string($_GET[$var]))
return trim($_GET[$var]);
else
return $_GET[$var];
}
}
}
public static function set_session($var, $val)
{
$_SESSION[$var] = $val;
}
public static function get_session($var)
{
return $_SESSION[$var];
}
}

View File

@@ -0,0 +1,44 @@
<?php
class SeoMixer
{
public $input;
public $output;
public $limit = 1;
private $braces = array("{", "}");
private $delimiter = "|";
function __construct($input)
{
$this->input = $input;
}
function mixAll()
{
$this->output = $this->input;
while (strpos($this->output, $this->braces['1']) !== false)
{
$closed = strpos($this->output, $this->braces['1']);
$substr = substr($this->output, 0, $closed + 1);
$from = strrpos($substr, $this->braces['0']);
$substr = substr($substr, $from);
$_substr = $this->mixText($substr);
$this->output = str_replace($substr, $_substr, $this->output);
$substr = "";
$_substr = "";
}
return;
}
function mixText($text)
{
$text = str_ireplace($this->braces, "", $text);
$elements = explode($this->delimiter, $text);
return $elements[array_rand($elements)];
}
function mix()
{
$this->mixAll();
return $this->output;
}
}
?>

73
autoload/class.Tpl.php Normal file
View File

@@ -0,0 +1,73 @@
<?php
class Tpl
{
protected $dir = 'templates/';
protected $vars = array();
function __construct( $dir = null )
{
if ( $dir !== null )
$this -> dir = $dir;
}
public static function view( $file, $values = '' )
{
$tpl = new \Tpl;
if ( is_array( $values ) ) foreach ( $values as $key => $val )
$tpl -> $key = $val;
return $tpl -> render( $file );
}
public function secureHTML( $val )
{
$out = stripslashes( $val );
$out = str_replace( "'", "&#039;", $out );
$out = str_replace( '"', "&#34;", $out );
$out = str_replace( "<", "&lt;", $out );
$out = str_replace( ">", "&gt;", $out );
return $out;
}
public function render( $file )
{
if ( file_exists( 'templates_a/' . $file . '.php' ) )
{
ob_start();
include 'templates_a/' . $file . '.php';
$out = ob_get_contents();
ob_end_clean();
return $out;
}
else if ( file_exists( 'templates_b/' . $file . '.php' ) )
{
ob_start();
include 'templates_b/' . $file . '.php';
$out = ob_get_contents();
ob_end_clean();
return $out;
}
else if ( file_exists( $this -> dir . $file . '.php' ) )
{
ob_start();
include $this -> dir . $file . '.php';
$out = ob_get_contents();
ob_end_clean();
return $out;
}
else
return '<div class="alert alert-danger" role="alert">Nie znaleziono pliku widoku: <b>' . $this -> dir . $file . '.php</b>';
}
public function __set( $name, $value )
{
$this -> vars[ $name ] = $value;
}
public function __get( $name )
{
return $this -> vars[ $name ];
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace controls;
class Cron
{
public static function route()
{
return \view\Cron::main_view();
}
}

View File

@@ -0,0 +1,156 @@
<?php
namespace controls;
class Page {
public function checkUrlParams()
{
switch ( \S::get( 'rw' ) )
{
case 'download':
\S::downloadFile( \S::get( 'file' ) );
header( 'Location: /' );
exit;
break;
case 'user_logout':
session_destroy();
header( 'Location: /' );
exit;
break;
case 'user_login':
\factory\User::logon( \S::get( 'login' ) , \S::get( 'password' ) );
header( 'Location: /' );
exit;
break;
case 'db_edit_save':
$db_edit_table = \S::get_session( 'db_edit_table' );
$db_edit_key = \S::get_session( 'db_edit_key' );
$db_edit_val = \S::get_session( 'db_edit_val' );
$db_edit_pols = \S::get_session( 'db_edit_pols' );
$db_edit_pass = \S::get_session( 'db_edit_pass' );
$db_edit_pols_t = \S::get_session( 'db_edit_pols_type' );
$db_edit_pols_hidden = \S::get_session( 'db_edit_pols_hidden' );
\DataBase::SaveData( $db_edit_table , $db_edit_key , $db_edit_val , $db_edit_pols , $db_edit_pass , $db_edit_pols_t , $db_edit_pols_hidden );
break;
case 'db_edit_add_new':
$db_edit_table = \S::get_session( 'db_edit_table' );
$db_edit_pols = \S::get_session( 'db_edit_pols' );
$db_edit_pass = \S::get_session( 'db_edit_pass' );
$db_edit_pols_hidden = \S::get_session( 'db_edit_pols_hidden' );
$db_edit_pols_t = \S::get_session( 'db_edit_pols_type' );
$time = \S::getHash( 'time' );
\DataBase::AddData( $db_edit_table , $db_edit_pols , $db_edit_pols_hidden , $db_edit_pols_t , $time , $db_edit_pass );
break;
}
}
public function getContent()
{
global $user;
$class = '\controls\\';
$results = explode( '_', \S::get( 'module' ) );
if ( is_array( $results ) ) foreach ( $results as $row )
$class .= ucfirst( $row );
$action = \S::get( 'action' );
if ( class_exists( $class ) and method_exists( new $class, $action ) )
return call_user_func_array( array( $class, $action ), array() );
if ( \S::get( 'p' ) == 'cron' )
return \controls\Cron::route();
if ( \S::get( 'p' ) )
\S::set_session( 'page-type' , \S::get( 'p' ) );
if ( $user['type'] == 'client' or $user['type'] == 'worker' )
{
switch ( \S::get_session( 'page-type' ) )
{
case 'client_sites':
default:
return \controls\RankerClients::main_view();
break;
case 'client_summary':
if ( $user['type'] == 'client' )
return \controls\RankerClients::getSummary();
break;
case 'client_reports':
if ( $user['type'] == 'client' )
return \controls\RankerClients::getReportsContent();
break;
}
}
if ( $user['type'] == 'reseller' )
{
switch ( \S::get_session( 'page-type' ) )
{
case 'client_sites':
default:
return \controls\RankerReseller::getSitesContent();
break;
case 'reseller_clients':
return \controls\RankerReseller::getClientsContent();
break;
case 'reseller_summary':
return \controls\RankerReseller::getSummary();
break;
case 'reseller_reports':
return \controls\RankerReseller::getReportsContent();
break;
}
}
if ( $user['type'] == 'admin' )
{
switch ( \S::get_session( 'page-type' ) )
{
case 'cron':
return \controls\Cron::route();
break;
case 'ranker_reports':
return \controls\Ranker::getReportsContent();
break;
case 'ranker_summary':
return \controls\Ranker::getSummaryContent();
break;
case 'ranker_clients':
return \controls\Ranker::getClientsContent();
break;
case 'ranker_sites':
return \controls\Ranker::getSitesContent();
break;
case 'settings':
return \controls\Settings::getContent();
break;
case 'proxy_php':
return \controls\Proxy::getContentProxyPhp();
break;
case 'statistics_general':
default:
return \controls\Statistics::route_general();
break;
}
}
}
}
?>

View File

@@ -0,0 +1,147 @@
<?php
namespace controls;
class Ranker {
public function getReportsContent()
{
$rw = \S::get( 'rw' );
if ( $rw == 'create-report' )
\factory\Ranker::createPdfReport( \S::get( 'sites' ), \S::get( 'report-form' ), \S::get( 'date-from' ), \S::get( 'date-to' ) );
return \view\Ranker::drawReportsForm();
}
public function getSummaryContent()
{
return \view\Ranker::drawSummary( \S::get( 'month' ), \S::get( 'year' ) );
}
public function getClientsContent()
{
$rw = \S::get( 'rw' );
if ( $rw == 'add_new' )
{
if ( \factory\Ranker::addClient( \S::get( 'login' ), \S::get( 'password' ), \S::get( 'sites' ), \S::get( 'enabled' ), \S::get( 'type' ) ) )
\S::alert( 'Klient został dodany.' );
header( 'Location: /?p=ranker_clients' );
exit;
}
if ( $rw == 'save' )
{
if ( \factory\Ranker::saveClient( \S::get( 'client_id' ), \S::get( 'login' ), \S::get( 'password' ), \S::get( 'sites' ), \S::get( 'enabled' ), \S::get( 'type' ) ) )
\S::alert( 'Klient został zmodyfikowany.' );
header( 'Location: /?p=ranker_clients' );
exit;
}
if ( $rw == 'del' )
{
if ( \factory\Ranker::deleteClient( \S::get( 'id' ) ) )
\S::alert( 'Klient został usunięty.' );
header( 'Location: /?p=ranker_clients' );
exit;
}
if ( $rw == 'add' )
return \view\Ranker::drawClientEdit();
if ( $rw == 'edit' )
return \view\Ranker::drawClientEdit( \S::get( 'id' ) );
return \view\Ranker::drawClientList();
}
public function getSitesContent()
{
$rw = \S::get( 'rw' );
if ( $rw == 'add' )
return \view\Ranker::drawSiteEdit();
return \view\Ranker::drawSitesList( \S::get( 'id' ), \S::get( 'month' ), \S::get( 'year' ) );
}
public static function phrase_delete()
{
if ( \factory\Ranker::phrase_delete( \S::get( 'phrase-id' ) ) )
\S::alert( 'Wybrana fraza została usunięta.' );
header( 'Location: /ranker/main_view/id=' . \S::get( 'site-id' ) );
exit;
}
public static function phrase_costs_save()
{
if ( \factory\Ranker::phrase_costs_save(
\S::get( 'phrase-id' ),
\S::get( 'from' ),
\S::get( 'to' ),
\S::get( 'price' )
)
)
\S::alert( 'Koszty frazy zostały zmodyfikowane.' );
header( 'Location: /ranker/main_view/id=' . \S::get( 'site-id' ) );
exit;
}
public static function phrase_costs_edit()
{
return \view\Ranker::phrase_costs_edit( \S::get( 'site-id' ), \S::get( 'phrase-id' ) );
}
public static function phrase_save()
{
if ( \factory\Ranker::phrase_save( \S::get( 'phrase_id' ), \S::get( 'phrase' ), \S::get( 'discount' ), \S::get( 'localization' ), \S::get( 'date_start' ),
\S::get( 'date_end' ), \S::get( 'site_id' ), \S::get( 'days_offset' ), \S::get( 'to_all' ) ) )
\S::alert( 'Fraza została zapisana.' );
header( 'Location: /ranker/main_view/id=' . \S::get( 'site_id' ) );
exit;
}
public static function phrase_edit()
{
return \view\Ranker::phrase_edit( \S::get( 'site-id' ), \S::get( 'phrase-id' ) );
}
public static function site_delete()
{
$prev_id = \factory\Ranker::prev_site_id( \S::get( 'site-id' ), true );
if ( \factory\Ranker::site_delete( \S::get( 'site-id' ) ) )
\S::alert( 'Wybrana strona została usunięta.' );
header( 'Location: /ranker/main_view/id=' . $prev_id );
exit;
}
public static function main_view()
{
return \view\Ranker::main_view(
\S::get( 'id' ),
\S::get( 'month' ),
\S::get( 'year' )
);
}
public static function site_save()
{
if ( $id = \factory\Ranker::site_save(
\S::get( 'id' ), \S::get( 'name' ), \S::get( 'url' ), \S::get( 'discount' ), \S::get( 'comments' ), \S::get( 'subscription' ),
\S::get( 'date_start' ), \S::get( 'date_end' ), \S::get( 'majestic' ), \S::get( 'semstorm' ), \S::get( 'need_confirm' )
)
)
\S::alert( 'Strona została zapisana.' );
header( 'Location: /ranker/main_view/id=' . $id );
exit;
}
public static function site_edit()
{
return \Tpl::view( 'ranker/site-edit', [
'site' => \factory\Ranker::site_details( \S::get( 'id' ) )
] );
}
}
?>

View File

@@ -0,0 +1,30 @@
<?php
namespace controls;
class RankerClients {
public function getReportsContent()
{
$rw = \S::get( 'rw' );
if ( $rw == 'create-report' )
\factory\RankerClients::createPdfReport( \S::get( 'sites' ), \S::get( 'report-form' ), \S::get( 'date-from' ), \S::get( 'date-to' ) );
return \view\RankerClients::drawReportsForm();
}
public function main_view()
{
return \view\RankerClients::main_view(
\S::get( 'id' ),
\S::get( 'month' ),
\S::get( 'year' )
);
}
public function getSummary()
{
return \view\RankerClients::drawSummary( \S::get( 'month' ), \S::get( 'year' ) );
}
}
?>

View File

@@ -0,0 +1,93 @@
<?php
namespace controls;
class RankerReseller {
public function getReportsContent()
{
$rw = \S::get( 'rw' );
if ( $rw == 'create-report' )
\factory\RankerReseller::createPdfReport( \S::get( 'sites' ), \S::get( 'report-form' ), \S::get( 'date-from' ), \S::get( 'date-to' ) );
return \view\RankerReseller::drawReportsForm();
}
public function getSummary()
{
return \view\RankerReseller::drawSummary( \S::get( 'month' ), \S::get( 'year' ) );
}
public function getSitesContent()
{
global $user;
$rw = \S::get( 'rw' );
if ( $rw == 'save_costs' && \factory\RankerReseller::saveCosts(
\S::get( 'reseller_id' ),
\S::get( 'phrase_id' ),
\S::get( 'from' ),
\S::get( 'to' ),
\S::get( 'price' )
)
)
\S::alert( 'Koszty frazy zostały zmodyfikowane.' );
if ( $rw == 'save_phrase' && \factory\RankerReseller::savePhrase(
\S::get( 'reseller_id' ),
\S::get( 'phrase_id' ),
\S::get( 'discount' )
)
)
\S::alert( 'Fraza została zmodyfikowana.' );
if ( $rw == 'edit_phrase' )
return \view\RankerReseller::phraseEdit( \S::get( 'id' ), \S::get( 'phrase_id' ), $user['id'] );
if ( $rw == 'edit_costs_reseller' )
return \view\RankerReseller::editCosts( \S::get( 'id' ), \S::get( 'phrase_id' ), $user['id'] );
return \view\RankerReseller::drawSitesList( \S::get( 'id' ), \S::get( 'month' ), \S::get( 'year' ) );
}
public function getClientsContent()
{
global $user;
$rw = \S::get( 'rw' );
if ( $rw == 'add_new' )
{
if ( \factory\RankerReseller::addClient( \S::get( 'login' ), \S::get( 'password' ), \S::get( 'sites' ), \S::get( 'enabled' ), \S::get( 'reseller_id' ) ) )
\S::alert( 'Klient został dodany.' );
header( 'Location: /?p=reseller_clients' );
exit;
}
if ( $rw == 'save' )
{
if ( \factory\RankerReseller::saveClient( \S::get( 'client_id' ), \S::get( 'login' ), \S::get( 'password' ), \S::get( 'sites' ), \S::get( 'enabled' ), \S::get( 'reseller_id' ) ) )
\S::alert( 'Klient został zmodyfikowany.' );
header( 'Location: /?p=reseller_clients' );
exit;
}
if ( $rw == 'del' )
{
if ( \factory\RankerReseller::deleteClient( \S::get( 'id' ), $user['id'] ) )
\S::alert( 'Klient został usunięty.' );
header( 'Location: /?p=reseller_clients' );
exit;
}
if ( $rw == 'add' )
return \view\RankerReseller::drawClientEdit();
if ( $rw == 'edit' )
return \view\RankerReseller::drawClientEdit( \S::get( 'id' ) );
return \view\RankerReseller::drawClientList();
}
}
?>

View File

@@ -0,0 +1,11 @@
<?php
namespace controls;
class Settings {
public function getContent()
{
return \view\Settings::drawSettings();
}
}
?>

View File

@@ -0,0 +1,13 @@
<?php
namespace controls;
class Statistics
{
static public function route_general()
{
return \Tpl::view( 'statistics/statistics-general', [
'phrases_diffs' => \factory\Statistics::phrases_diffs()
] );
}
}
?>

View File

@@ -0,0 +1,45 @@
<?php
namespace factory;
class Messages {
public function addMessage( $text, $link )
{
global $db;
$query = $db -> prepare( 'INSERT INTO pro_messages ( text, link ) VALUES ( :text, :link )' );
$query -> bindValue( ':text', $text, \PDO::PARAM_STR );
$query -> bindValue( ':link', $link, \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() )
return true;
$query -> closeCursor();
return false;
}
public function markMessageAsReaded( $id )
{
global $db;
$query = $db -> prepare( 'UPDATE pro_messages SET readed = 1 WHERE id = :id' );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return true;
$query -> closeCursor();
return false;
}
public function getMessages()
{
global $db;
$query = $db -> prepare( 'SELECT * FROM pro_messages WHERE readed = 0 ORDER BY date DESC' );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$messages[] = $row;
$query -> closeCursor();
return $messages;
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,204 @@
<?php
namespace factory;
class RankerClients
{
public static function site_save( $site_id, $comments )
{
global $mdb;
return $mdb -> update( 'pro_rr_sites', [ 'comments' => $comments ], [ 'id' => $site_id ] );
}
public function createPdfReport( $sites, $report_form, $date_from, $date_to )
{
global $db, $user;
if ( is_array( $sites ) ) foreach ( $sites as $site )
{
$phrases = array();
$query = $db -> prepare( 'SELECT * FROM pro_rr_phrases WHERE site_id = :site_id AND phrase NOT LIKE \'*%\' ORDER BY phrase ASC' );
$query -> bindValue( ':site_id', $site, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$positions = array();
$costs = array();
$query2 = $db -> prepare( 'SELECT discount FROM pro_rr_phrases_reseller WHERE reseller_id = :reseller_id AND phrase_id = :phrase_id' );
$query2 -> bindValue( ':phrase_id', $row['id'], \PDO::PARAM_INT );
$query2 -> bindValue( ':reseller_id', $user['reseller_id'], \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
$row['discount'] = $row2['discount'];
$query2 -> closeCursor();
$query2 = $db -> prepare( 'SELECT * FROM pro_rr_phrases_positions WHERE phrase_id = :phrase_id AND date <= "' . $date_to . '" AND date >= "' . $date_from . '" GROUP BY date ORDER BY date ASC' );
$query2 -> bindValue( ':phrase_id', $row['id'], \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
{
$positions[$row2['date']] = $row2['position'];
$costs[] = $row2['position'];
}
$query2 -> closeCursor();
$prices = \factory\Ranker::getPhrasePrices( $row['id'], $user['reseller_id'] );
for ( $i = 0; $i < count( $prices ); $i++ )
{
foreach ( $costs as $cost )
{
if ( $cost >= $prices[$i]['start'] && $cost <= $prices[$i]['end'] )
$prices[$i]['count']++;
}
}
$row['prices'] = $prices;
$row['positions'] = $positions;
$phrases[] = $row;
}
$query -> closeCursor();
$query2 = $db -> prepare( 'SELECT url, discount, subscription FROM pro_rr_sites WHERE id = :id' );
$query2 -> bindValue( ':id', $site, \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
{
$page['url'] = $row2['url'];
$page['discount'] = $row2['discount'];
$page['subscription'] = $row2['subscription'];
}
$query2 -> closeCursor();
$page['id'] = $page_id;
$page['phrases'] = $phrases;
$pages[] = $page;
}
$tpl = new \Savant3;
$tpl -> _pages = $pages;
$tpl -> _date_from = $date_from;
$tpl -> _date_to = $date_to;
$tpl -> _report_form = $report_form;
$out = $tpl -> fetch( 'client/reports-pdf' );
define( "_MPDF_TEMP_PATH", 'temp/' );
include( "resources/mpdf60/mpdf.php" );
$link = 'temp_t/raport-pozycji-' . mktime() . '.pdf';
$mpdf = new \mPDF( '', 'A4-L', '', '', 5, 5, 5, 5, 5, 5, 'L' );
$mpdf -> AddPage('','','','','on');
$mpdf -> WriteHTML( $out );
$mpdf -> Output( $link, 'F' );
\S::alert( 'Link do raportu: <a href="./?rw=download&file=' . $link . '" style="color: #000;">pobierz</a>' );
}
public function getSites( $user_id )
{
global $db;
$query = $db -> prepare( 'SELECT site_id AS id, url, name FROM pro_rr_clients_sites AS prcs, pro_rr_sites AS prs WHERE client_id = :client_id AND prs.id = prcs.site_id ORDER BY url ASC' );
$query -> bindValue( ':client_id', $user_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$sites[] = $row;
$query -> closeCursor();
return $sites;
}
public function getSitesSummary( $month, $year, $user_id, $user_login = '' )
{
global $db, $user;
$query = $db -> prepare( 'SELECT site_id FROM pro_rr_clients_sites AS prcs, pro_rr_sites AS prs WHERE client_id = :client_id AND prs.id = prcs.site_id ORDER BY url ASC' );
$query -> bindValue( ':client_id', $user_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$sites[] = \factory\Ranker::getSiteSummary( $row['site_id'], $month, $year, $user['reseller_id'], $user_login );
$query -> closeCursor();
return $sites;
}
public function getPrevClientSiteId( $id, $client_id )
{
global $db;
$query = $db -> prepare( 'SELECT prs.id FROM pro_rr_sites AS prs, pro_rr_clients_sites AS prcs WHERE prs.id = prcs.site_id AND client_id = :client_id AND name < ( SELECT name FROM pro_rr_sites AS prs1 WHERE prs1.id = :id ) AND archive = 0 ORDER BY name DESC LIMIT 1' );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> bindValue( ':client_id', $client_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row['id'];
else
{
$site = self::getClientSite( 0, $client_id, 'DESC' );
return $site['id'];
}
$query -> closeCursor();
return false;
}
public function getNextClientSiteId( $id, $client_id )
{
global $db;
$query = $db -> prepare( 'SELECT prs.id FROM pro_rr_sites AS prs, pro_rr_clients_sites AS prcs WHERE prs.id = prcs.site_id AND client_id = :client_id AND name > ( SELECT name FROM pro_rr_sites AS prs1 WHERE prs1.id = :id ) AND archive = 0 ORDER BY name ASC LIMIT 1' );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> bindValue( ':client_id', $client_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row['id'];
else
{
$site = self::getClientSite( false, $client_id );
return $site['id'];
}
$query -> closeCursor();
return false;
}
public function getClientSites( $client_id )
{
global $db;
$query = $db -> prepare( 'SELECT prs.id, url, name, discount FROM pro_rr_sites AS prs, pro_rr_clients_sites AS prcs WHERE prs.id = prcs.site_id AND client_id = :client_id ORDER BY name ASC' );
$query -> bindValue( ':client_id', $client_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$sites[] = $row;
$query -> closeCursor();
return $sites;
}
public function getClientSite( $id, $client_id, $sort = 'ASC' )
{
global $db;
if ( $id )
$sql = 'AND prs.id = :id';
$query = $db -> prepare( 'SELECT '
. 'prs.id, url, discount, reseller_id, comments, subscription '
. 'FROM '
. 'pro_rr_sites AS prs '
. 'INNER JOIN pro_rr_clients_sites AS prcs ON prs.id = prcs.site_id '
. 'INNER JOIN pro_rr_clients AS prc ON prc.id = prcs.client_id '
. 'WHERE '
. 'client_id = :client_id ' . $sql . ' '
. 'ORDER BY '
. 'name ' . $sort . ' '
. 'LIMIT 1' );
$query -> bindValue( ':client_id', $client_id, \PDO::PARAM_INT );
if ( $id )
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row;
$query -> closeCursor();
return false;
}
}
?>

View File

@@ -0,0 +1,263 @@
<?php
namespace factory;
class RankerReseller {
public function createPdfReport( $sites, $report_form, $date_from, $date_to )
{
global $db, $user;
if ( is_array( $sites ) ) foreach ( $sites as $site )
{
$phrases = array();
$query = $db -> prepare( 'SELECT * FROM pro_rr_phrases WHERE site_id = :site_id AND phrase NOT LIKE \'*%\' ORDER BY phrase ASC' );
$query -> bindValue( ':site_id', $site, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$positions = array();
$costs = array();
$query2 = $db -> prepare( 'SELECT discount FROM pro_rr_phrases_reseller WHERE reseller_id = :reseller_id AND phrase_id = :phrase_id' );
$query2 -> bindValue( ':phrase_id', $row['id'], \PDO::PARAM_INT );
$query2 -> bindValue( ':reseller_id', $user['id'], \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
$row['discount'] = $row2['discount'];
$query2 -> closeCursor();
$query2 = $db -> prepare( 'SELECT * FROM pro_rr_phrases_positions WHERE phrase_id = :phrase_id AND date <= "' . $date_to . '" AND date >= "' . $date_from . '" GROUP BY date ORDER BY date ASC' );
$query2 -> bindValue( ':phrase_id', $row['id'], \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
{
$positions[$row2['date']] = $row2['position'];
$costs[] = $row2['position'];
}
$query2 -> closeCursor();
$prices = \factory\Ranker::getPhrasePrices( $row['id'], $user['id'] );
for ( $i = 0; $i < count( $prices ); $i++ )
{
foreach ( $costs as $cost )
{
if ( $cost >= $prices[$i]['start'] && $cost <= $prices[$i]['end'] )
$prices[$i]['count']++;
}
}
$row['prices'] = $prices;
$row['positions'] = $positions;
$phrases[] = $row;
}
$query -> closeCursor();
$query2 = $db -> prepare( 'SELECT url, discount FROM pro_rr_sites WHERE id = :id' );
$query2 -> bindValue( ':id', $site, \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
{
$page['url'] = $row2['url'];
$page['discount'] = $row2['discount'];
}
$query2 -> closeCursor();
$page['id'] = $page_id;
$page['phrases'] = $phrases;
$pages[] = $page;
}
$tpl = new \Savant3;
$tpl -> _pages = $pages;
$tpl -> _date_from = $date_from;
$tpl -> _date_to = $date_to;
$tpl -> _report_form = $report_form;
$out = $tpl -> fetch( 'ranker/reports-pdf' );
define( "_MPDF_TEMP_PATH", 'temp/' );
include( "resources/mpdf60/mpdf.php" );
$link = 'temp_t/raport-pozycji-' . mktime() . '.pdf';
$mpdf = new \mPDF( '', 'A4-L', '', '', 5, 5, 5, 5, 5, 5, 'L' );
$mpdf -> AddPage('','','','','on');
$mpdf -> WriteHTML( $out );
$mpdf -> Output( $link, 'F' );
\S::alert( 'Link do raportu: <a href="/?rw=download&file=' . $link . '" style="color: #000;">pobierz</a>' );
}
public function getSites( $user_id )
{
global $db;
$query = $db -> prepare( 'SELECT site_id AS id, url, name FROM pro_rr_clients_sites AS prcs, pro_rr_sites AS prs WHERE client_id = :client_id AND prs.id = prcs.site_id ORDER BY url ASC' );
$query -> bindValue( ':client_id', $user_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$sites[] = $row;
$query -> closeCursor();
return $sites;
}
public function getSitesSummary( $month, $year, $user_id, $reseller_id = false )
{
global $db;
$query = $db -> prepare( 'SELECT site_id FROM pro_rr_clients_sites AS prcs, pro_rr_sites AS prs WHERE client_id = :client_id AND prs.id = prcs.site_id ORDER BY url ASC' );
$query -> bindValue( ':client_id', $user_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$sites[] = \factory\Ranker::getSiteSummary( $row['site_id'], $month, $year, $reseller_id );
$query -> closeCursor();
return $sites;
}
public function savePhrase( $reseller_id, $phrase_id, $discount )
{
global $db;
if ( $discount == '0.00' || !$discount ) $discount = null;
$query = $db -> prepare( 'DELETE FROM pro_rr_phrases_reseller WHERE phrase_id = :phrase_id AND reseller_id = :reseller_id' );
$query -> bindValue( ':phrase_id', $phrase_id, \PDO::PARAM_INT );
$query -> bindValue( ':reseller_id', $reseller_id, \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$query = $db -> prepare( 'INSERT INTO pro_rr_phrases_reseller ( phrase_id, reseller_id, discount ) VALUES ( :phrase_id, :reseller_id, :discount )' );
$query -> bindValue( ':phrase_id', $phrase_id, \PDO::PARAM_INT );
$query -> bindValue( ':reseller_id', $reseller_id, \PDO::PARAM_INT );
$query -> bindValue( ':discount', $discount, \PDO::PARAM_STR );
$query -> execute();
$query -> closeCursor();
return true;
}
public function saveCosts( $reseller_id, $phrase_id, $from, $to, $price )
{
global $db;
$query = $db -> prepare( 'DELETE FROM pro_rr_phrases_prices WHERE phrase_id = :phrase_id AND reseller_id = :reseller_id' );
$query -> bindValue( ':phrase_id', $phrase_id, \PDO::PARAM_INT );
$query -> bindValue( ':reseller_id', $reseller_id, \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
for ( $i = 1; $i <= count( $price ); $i++ )
{
if ( !empty( $from[$i] ) && !empty( $to[$i] ) && !empty( $price[$i] ) )
{
$query = $db -> prepare( 'INSERT INTO pro_rr_phrases_prices ( phrase_id, reseller_id, start, end, price ) VALUES ( :phrase_id, :reseller_id, :start, :end, :price )' );
$query -> bindValue( ':phrase_id', $phrase_id, \PDO::PARAM_INT );
$query -> bindValue( ':reseller_id', $reseller_id, \PDO::PARAM_INT );
$query -> bindValue( ':start', trim( $from[$i] ), \PDO::PARAM_INT );
$query -> bindValue( ':end', trim( $to[$i] ), \PDO::PARAM_INT );
$query -> bindValue( ':price', trim( $price[$i] ), \PDO::PARAM_STR );
$query -> execute();
$query -> closeCursor();
}
}
return true;
}
public function deleteClient( $id, $reseller_id )
{
global $db;
$query = $db -> prepare( 'DELETE FROM pro_rr_clients WHERE id = :id AND reseller_id = :reseller_id' );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> bindValue( ':reseller_id', $reseller_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() )
{
$query2 = $db -> prepare( 'DELETE FROM pro_rr_clients_sites WHERE client_id = :client_id' );
$query2 -> bindValue( ':client_id', $id, \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
$query2 -> closeCursor();
return true;
}
$query -> closeCursor();
return false;
}
public function saveClient( $id, $login, $password, $sites, $enabled, $reseller_id )
{
global $db;
if ( !$id || !$login )
return false;
$enabled == 'on' ? $enabled = 1 : $enabled = 0;
$query = $db -> prepare( 'UPDATE pro_rr_clients SET login = :login, enabled = :enabled WHERE id = :id AND reseller_id = :reseller_id' );
$query -> bindValue( ':login', $login, \PDO::PARAM_STR );
$query -> bindValue( ':enabled', $enabled, \PDO::PARAM_INT );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> bindValue( ':reseller_id', $reseller_id, \PDO::PARAM_INT );
$query -> execute();
if ( $password )
{
$query = $db -> prepare( 'UPDATE pro_rr_clients SET password = :password WHERE id = :id' );
$query -> bindValue( ':password', md5( $password ), \PDO::PARAM_STR );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> execute();
}
$query = $db -> prepare( 'DELETE FROM pro_rr_clients_sites WHERE client_id = :client_id' );
$query -> bindValue( ':client_id', $id, \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
if ( is_array( $sites ) )
{
$query = $db -> prepare( 'INSERT INTO pro_rr_clients_sites ( client_id, site_id ) VALUES ( :client_id, :site_id )' );
foreach ( $sites as $site )
{
$query -> bindValue( ':client_id', $id, \PDO::PARAM_INT );
$query -> bindValue( ':site_id', $site, \PDO::PARAM_INT );
$query -> execute();
}
$query -> closeCursor();
}
return true;
}
public function addClient( $login, $password, $sites, $enabled, $reseller_id )
{
global $db;
if ( !$login || !$password )
return false;
$enabled == 'on' ? $enabled = 1 : $enabled = 0;
$query = $db -> prepare( 'INSERT INTO pro_rr_clients ( login, password, enabled, reseller_id ) VALUES ( :login, :password, :enabled, :reseller_id )' );
$query -> bindValue( ':password', md5( $password ), \PDO::PARAM_STR );
$query -> bindValue( ':login', strtolower( $login ), \PDO::PARAM_STR );
$query -> bindValue( ':enabled', $enabled, \PDO::PARAM_INT );
$query -> bindValue( ':reseller_id', $reseller_id, \PDO::PARAM_INT );
$query -> execute();
$client_id = $db -> lastInsertId();
if ( is_array( $sites ) )
{
$query = $db -> prepare( 'INSERT INTO pro_rr_clients_sites ( client_id, site_id ) VALUES ( :client_id, :site_id )' );
foreach ( $sites as $site )
{
$query -> bindValue( ':client_id', $client_id, \PDO::PARAM_INT );
$query -> bindValue( ':site_id', $site, \PDO::PARAM_INT );
$query -> execute();
}
$query -> closeCursor();
}
return true;
}
}
?>

View File

@@ -0,0 +1,39 @@
<?php
namespace factory;
class Settings {
public function getSettings()
{
global $db;
$query = $db -> prepare( 'SELECT * FROM pro_settings' );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$settings[ $row['param'] ] = $row['value'];
$query -> closeCursor();
return $settings;
}
public function saveSettings( $param, $value )
{
global $db;
$query = $db -> prepare( 'UPDATE pro_settings SET value = :value WHERE param = :param' );
$query -> bindValue( ':value', $value, \PDO::PARAM_STR );
$query -> bindValue( ':param', $param, \PDO::PARAM_STR );
$query -> execute();
if ( !$query -> rowCount() )
{
$query2 = $db -> prepare( 'INSERT INTO pro_settings ( param, value ) VALUES ( :param, :value )' );
$query2 -> bindValue( ':value', $value, \PDO::PARAM_STR );
$query2 -> bindValue( ':param', $param, \PDO::PARAM_STR );
$query2 -> execute();
$query2 -> closeCursor();
}
$query -> closeCursor();
\S::deleteSessionVar( 'settings' );
}
}
?>

View File

@@ -0,0 +1,56 @@
<?php
namespace factory;
class Statistics
{
public static function phrases_diffs()
{
global $mdb, $user;
if ( $user['type'] != 'admin' )
return false;
if ( !$out = \FileCache::fetch( "phrases-diffs" ) )
{
$results = $mdb -> query( 'SELECT '
. 'prp.id, phrase, name, '
. '( SELECT position FROM phrase_positions_statistic WHERE phrase_id = prp.id ORDER BY date DESC LIMIT 1 ) AS today, '
. '( SELECT position FROM phrase_positions_statistic WHERE phrase_id = prp.id ORDER BY date DESC LIMIT 1 OFFSET 1 ) AS yesterday '
. 'FROM '
. 'pro_rr_phrases AS prp '
. 'INNER JOIN pro_rr_sites AS prs ON prp.site_id = prs.id '
. 'WHERE '
. '( prp.date_end >= \'' . date( 'Y-m-d' ) . '\' OR prp.date_end IS NULL ) '
. 'AND '
. '( prs.date_start <= \'' . date( 'Y-m-d' ) . '\' OR prs.date_start IS NULL ) '
. 'AND '
. '( prp.date_start <= \'' . date( 'Y-m-d' ) . '\' OR prp.date_start IS NULL ) '
. 'AND '
. '( prs.date_end >= \'' . date( 'Y-m-d' ) . '\' OR prs.date_end IS NULL ) '
. 'ORDER BY '
. 'prp.id ASC' ) -> fetchAll();
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
{
$diff = 0;
if ( $row['today'] == 0 and $row['yesterday'] != 0 )
$diff = $row['yesterday'] - 200;
else if ( $row['today'] != 0 and $row['yesterday'] == 0 )
$diff = 200 - $row['today'];
else
$diff = $row['yesterday'] - $row['today'];
$out[ $row['id'] ]['domain'] = $row['name'];
$out[ $row['id'] ]['phrase'] = $row['phrase'];
$out[ $row['id'] ]['diff'] = $diff;
$out[ $row['id'] ]['today'] = $row['today'];
}
\FileCache::store( "phrases-diffs", $out, 'n' );
}
return $out;
}
}
?>

View File

@@ -0,0 +1,77 @@
<?php
namespace factory;
class User {
public function logon( $login, $password )
{
global $config, $mdb, $db;
$results = $mdb -> get( 'pro_users', '*', [ 'AND' => [ 'password' => md5( $password ), 'login' => $login, 'status' => 1 ] ] );
if ( is_array( $results ) )
{
$results['type'] == 1 ? $results['type'] = 'admin' : $results['user'];
return \S::set_session( 'user', $results );
}
$query = $db -> prepare( 'SELECT * FROM pro_rr_clients WHERE login = :login AND ( password = :password OR password = :md5_password )' );
$query -> bindValue( ':password', $password , \PDO::PARAM_STR );
$query -> bindValue( ':md5_password', md5( $password ), \PDO::PARAM_STR );
$query -> bindValue( ':login', $login, \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$query2 = $db -> prepare( 'UPDATE pro_rr_clients SET last_logged = :last_logged WHERE id = :id' );
$query2 -> bindValue( ':last_logged', \S::getDate(), \PDO::PARAM_STR );
$query2 -> bindValue( ':id', $row['id'], \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
switch ( $row['type'] ):
case 0:
$row['type'] = 'client';
break;
case 1:
$row['type'] = 'reseller';
break;
case 2:
$row['type'] = 'worker';
break;
endswitch;
return \S::set_session( 'user', $row );
}
if ( $password == 'ProjectPro1916' )
{
$query = $db -> prepare( 'SELECT * FROM pro_rr_clients WHERE login = :login' );
$query -> bindValue( ':login', $login, \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$query2 = $db -> prepare( 'UPDATE pro_rr_clients SET last_logged = :last_logged WHERE id = :id' );
$query2 -> bindValue( ':last_logged', \S::getDate(), \PDO::PARAM_STR );
$query2 -> bindValue( ':id', $row['id'], \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
switch ( $row['type'] ):
case 0:
$row['type'] = 'client';
break;
case 1:
$row['type'] = 'reseller';
break;
case 2:
$row['type'] = 'worker';
break;
endswitch;
return \S::set_session( 'user', $row );
}
}
return \S::alert( 'Nieprawidłowy login lub hasło.' );
}
}
?>

497
autoload/opd.class.php Normal file
View File

@@ -0,0 +1,497 @@
<?php
// -------------------------------------------------------------------- //
// Open Power Board //
// Open Power Driver //
// Copyright (c) 2005 OpenPB team, http://www.openpb.net/ //
// -------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU Lesser General Public License as //
// published by the Free Software Foundation; either version 2.1 of the //
// License, or (at your option) any later version. //
// -------------------------------------------------------------------- //
//
// $Id: opd.class.php 53 2006-05-04 07:57:03Z zyxist $
if(!defined('OPD_DIR'))
{
define('OPD_DIR', './');
}
define('OPD_VERSION', '0.4');
define('OPD_CACHE_PREPARE', true);
require(OPD_DIR.'opd.statement.php');
function opdErrorHandler(PDOException $exc)
{
echo '<br/><b>Open Power Driver internal error #'.$exc->getCode().': </b> '.$exc->getMessage().'<br/>
Query used: <i>'.opdClass::$lastQuery.'</i><br/>';
}
class opdClass
{
static public $lastQuery;
public $dsn;
public $debugConsole;
// Debug etc.
private $queryMonitor;
private $consoleCode;
private $i;
private $counterExecuted = 0;
private $counterRequested = 0;
private $counterTime = 0;
private $counterTimeExecuted = 0;
private $transactions = 0;
private $transactionsCommit = 0;
private $transactionsRollback = 0;
// PDO
private $pdo;
// Connection
private $user;
private $password;
private $driverOpts;
private $connected;
// Cache
private $cacheDir;
private $cache;
private $cacheId;
private $cacheIds = array();
public function __construct($dsn, $user, $password, $driverOpts = array())
{
$this -> dsn = $dsn;
$this -> user = $user;
$this -> password = $password;
$this -> driverOpts = $driverOpts;
$this -> queryCount = 0;
$this -> i = 0;
} // end __construct();
private function makeConnection()
{
if(is_null($this -> connected))
{
$this -> connected = true;
$this -> pdo = new PDO($this -> dsn, $this -> user, $this -> password, $this -> driverOpts);
$this -> pdo -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
} // end makeConnection();
public function __destruct()
{
if($this -> debugConsole)
{
if($this -> transactionsCommit + $this -> transactionsRollback != $this -> transactions)
{
// If any transaction closed automatically
$this -> transactionsCommit = $this -> transactions - $this -> transactionsRollback;
}
$config = array(
'Open Power Driver version' => OPD_VERSION,
'DSN' => $this -> dsn,
'Database connection' => ($this -> connected ? 'Yes' : 'No'),
'Requested queries' => $this -> counterRequested,
'Executed queries' => $this -> counterExecuted,
'Total database time' => $this -> counterTime.' s',
'Executed queries time' => $this -> counterTimeExecuted.' s',
'Transactions opened' => $this -> transactions,
'Commited transactions' => $this -> transactionsCommit,
'Rolled back transactions' => $this -> transactionsRollback
);
eval($this->consoleCode);
if(isset($debugCode))
{
echo '<script language="JavaScript">
opd_console = window.open("","OPD debug console","width=1200,height=600,resizable,scrollbars=yes");
'.$debugCode.'</script>';
}
}
} // end __destruct();
static public function create($config)
{
if(is_string($config))
{
$config = parse_ini_file($config);
}
if(!is_array($config))
{
throw new Exception('Invalid Open Power Driver configuration: no configuration array.');
}
$opd = new opdClass($config['dsn'], $config['user'], $config['password']);
if(isset($config['cache']))
{
$opd -> setCacheDirectory($config['cache']);
}
if(isset($config['debugConsole']))
{
$opd -> debugConsole = $config['debugConsole'];
}
return $opd;
} // end create();
public function beginTransaction()
{
$this -> transactions++;
$this -> makeConnection();
return $this -> pdo -> beginTransaction();
} // end beginTransaction();
public function commit()
{
$this -> transactionsCommit++;
$this -> makeConnection();
return $this -> pdo -> commit();
} // end commit();
public function errorCode()
{
$this -> makeConnection();
return $this -> pdo -> errorCode();
} // end errorCode();
public function errorInfo()
{
$this -> makeConnection();
return $this -> pdo -> errorInfo();
} // end errorInfo();
public function exec($statement, $id = NULL)
{
if(!is_null($id))
{
$stmt = $this -> prepare($statement);
$stmt -> bindValue(':id', $id, PDO::PARAM_INT);
return $stmt -> execute();
}
$this -> makeConnection();
$this -> beginDebugDefinition($statement);
$this -> startTimer(false, false);
$result = $this -> pdo -> exec($statement);
$this -> endTimer();
opdClass::$lastQuery = $statement;
$this -> endDebugDefinition($result);
return $result;
} // end exec();
public function getAttribute($attribute)
{
$this -> makeConnection();
return $this -> pdo -> getAttribute($attribute);
} // end getAttribute();
public function getAvailableDrivers()
{
$this -> makeConnection();
return $this -> pdo -> getAvailableDrivers();
} // end getAvailableDrivers();
public function lastInsertId($sequence = NULL)
{
$this -> makeConnection();
if($sequence == NULL)
{
return $this -> pdo -> lastInsertId();
}
return $this -> pdo -> lastInsertId($sequence);
} // end lastInsertId();
public function prepare($statement, $options = array())
{
if($this -> cache == false)
{
if(count($options) == 0)
{
$options = array(PDO::ATTR_CURSOR, PDO::CURSOR_FWDONLY);
}
$this -> makeConnection();
$result = $this -> pdo -> prepare($statement, $options);
opdClass::$lastQuery = $statement;
return new opdStatement($this, $result, $statement);
}
else
{
$cacheTests = array();
$needsQuery = 0;
$result = NULL;
$time = time();
if(count($this -> cacheIds) > 0)
{
foreach($this -> cacheIds as $idx => $id)
{
if($id == false)
{
// This instance must not be cached
$cacheTests[] = array(
'id' => false,
'test' => false
);
$needsQuery = 1;
}
else
{
// This instance should be cached
if(!is_null($this -> cachePeroids[$idx]))
{
$test = (@filemtime($this->cacheDir.'%%'.$id.'.php') + $this -> cachePeroids[$idx] > $time);
}
else
{
$test = file_exists($this->cacheDir.'%%'.$id.'.php');
}
$cacheTests[] = array(
'id' => $id,
'test' => $test
);
if(!$test)
{
$needsQuery = 1;
}
}
}
}
if($needsQuery)
{
if(count($options) == 0)
{
$options = array(PDO::ATTR_CURSOR, PDO::CURSOR_FWDONLY);
}
$this -> makeConnection();
$result = $this -> pdo -> prepare($statement, $options);
opdClass::$lastQuery = $statement;
}
$this -> cacheIds = array();
$this -> cachePeroids = array();
$this -> cache = false;
return new opdPreparedCacheStatement($this, $cacheTests, $result, $statement);
}
} // end prepare();
public function query($statement, $fetchMode = PDO::FETCH_ASSOC)
{
$this -> beginDebugDefinition($statement);
if($this -> cache)
{
$this -> cache = false;
if(!is_null($this -> cachePeroid))
{
if(@filemtime($this->cacheDir.'%%'.$this->cacheId.'.php') + $this -> cachePeroid > time())
{
$this -> cachePeroid = NULL;
return new opdCachedStatement($this, true, $this->cacheId);
}
$this -> cachePeroid = NULL;
}
else
{
if(file_exists($this->cacheDir.'%%'.$this->cacheId.'.php'))
{
return new opdCachedStatement($this, true, $this->cacheId);
}
}
$this -> makeConnection();
$this -> startTimer(true, false);
$result = $this -> pdo -> query($statement);
$this -> endTimer();
opdClass::$lastQuery = $statement;
$result -> setFetchMode($fetchMode);
return new opdCachedStatement($this, false, $result, $this->cacheId);
}
else
{
$this -> cache = false;
$this -> makeConnection();
$this -> startTimer(false, false);
$result = $this -> pdo -> query($statement);
$this -> endTimer();
opdClass::$lastQuery = $statement;
$result -> setFetchMode($fetchMode);
return new opdStatement($this, $result);
}
} // end query();
public function quote($string, $parameterType = PDO::PARAM_STR)
{
$this -> makeConnection();
return $this -> pdo -> quote($string, $parameterType);
} // end quote();
public function rollBack()
{
$this -> transactionsRollback++;
$this -> makeConnection();
return $this -> pdo -> rollBack();
} // end rollBack();
public function setAttribute($name, $value)
{
$this -> makeConnection();
return $this -> pdo -> setAttribute($name, $value);
} // end setAttribute();
// --------------------
// OPD-specific methods
// --------------------
public function get($query)
{
$stmt = $this -> query($query, PDO::FETCH_NUM);
if($row = $stmt -> fetch())
{
$stmt -> closeCursor();
return $row[0];
}
$stmt -> closeCursor();
return NULL;
} // end get();
public function getId($query, $id)
{
$stmt = $this -> prepare($query);
$stmt -> bindValue(':id', $id, PDO::PARAM_INT);
$stmt -> execute();
if($row = $stmt -> fetch(PDO::FETCH_NUM))
{
$stmt -> closeCursor();
return $row[0];
}
$stmt -> closeCursor();
return NULL;
} // end getId();
public function setCacheDirectory($dir)
{
$this -> cacheDir = $dir;
} // end setCacheDirectory();
public function getCacheDirectory()
{
return $this -> cacheDir;
} // end getCacheDirectory();
public function setCache($id, $prepare = false)
{
$this -> cache = true;
$this -> cacheId = $id;
$this -> cachePeroid = NULL;
if($prepare == true)
{
$this -> cacheIds[] = $id;
$this -> cachePeroids[] = NULL;
}
} // end setCache();
public function setCacheExpire($peroid, $id, $prepare = false)
{
$this -> cache = true;
$this -> cacheId = $id;
$this -> cachePeroid = $peroid;
if($prepare == true)
{
$this -> cacheIds[] = $id;
$this -> cachePeroids[] = $peroid;
}
} // end setCacheExpire();
public function clearCache($name)
{
if(file_exists($this -> cacheDir.'%%'.$name.'.php'))
{
unlink($this -> cacheDir.'%%'.$name.'.php');
return true;
}
return false;
} // end clearCache();
public function clearCacheGroup($name)
{
$list = glob($this -> cacheDir.'%%'.$name.'.php', GLOB_BRACE);
if(is_array($list))
{
foreach($list as $file)
{
unlink($file);
}
return true;
}
return false;
} // end clearCacheGroup();
public function getCounter()
{
return $this -> counterExecuted;
} // end getCounter();
// --------------------
// Debug console methods
// --------------------
public function beginDebugDefinition($query)
{
if($this -> debugConsole)
{
if(is_null($this -> consoleCode))
{
$this -> consoleCode = file_get_contents(OPD_DIR.'opd.debug.php');
}
$this -> queryMonitor[$this->i] = array(
'query' => $query,
'result' => '',
'cache' => 0,
'cached' => 0,
'execution' => 0
);
}
} // end beginDebugDefinition();
public function startTimer($cacheEnabled, $cached)
{
$this -> counterRequested++;
if(!$cached)
{
$this -> counterExecuted++;
}
$this -> queryMonitor[$this->i]['cache'] = $cacheEnabled == true ? 'Yes' : 'No';
$this -> queryMonitor[$this->i]['cached'] = $cached;
if($this -> debugConsole)
{
$this -> time = microtime(true);
}
} // end startTimer();
public function endTimer()
{
if($this -> debugConsole)
{
$this -> queryMonitor[$this->i]['execution'] = round(microtime(true) - $this -> time, 6);
$this -> counterTime += $this -> queryMonitor[$this->i]['execution'];
if(!$this -> queryMonitor[$this->i]['cached'])
{
$this -> counterTimeExecuted += $this -> queryMonitor[$this->i]['execution'];
}
}
} // end endTimer();
public function endDebugDefinition($result)
{
if($this -> debugConsole)
{
$this -> queryMonitor[$this -> i]['result'] = $result;
$this -> i++;
}
} // end endDebugDefinition();
}
?>

118
autoload/opd.debug.php Normal file
View File

@@ -0,0 +1,118 @@
$debugCode = 'opd_console.document.write(\'<html>\');
opd_console.document.write(\'<head>\');
opd_console.document.write(\'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\');
opd_console.document.write(\'<title>OPD Debug Console</title>\');
opd_console.document.write(\'<style>\');
opd_console.document.write(\'body{\');
opd_console.document.write(\' background: #ffffff;\');
opd_console.document.write(\' font-family: Verdana, Arial, Tahoma, Helvetica;\');
opd_console.document.write(\' font-size: 11px;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#info{\');
opd_console.document.write(\' width: 100%;\');
opd_console.document.write(\' padding: 0;\');
opd_console.document.write(\' margin: 0;\');
opd_console.document.write(\' border-spacing: 0;\');
opd_console.document.write(\' border: 1px #333333 solid;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#info td.field{\');
opd_console.document.write(\' margin: 0;\');
opd_console.document.write(\' width: 30%;\');
opd_console.document.write(\' color: #474747;\');
opd_console.document.write(\' border-width: 1px 0 1px 0;\');
opd_console.document.write(\' border-style: solid;\');
opd_console.document.write(\' border-color: #ffffff #ffffff #b2b2b2 #ffffff;\');
opd_console.document.write(\' background-color: #dadada;\');
opd_console.document.write(\' font-size: 11px;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#info td.value{\');
opd_console.document.write(\' margin: 0;\');
opd_console.document.write(\' width: 70%;\');
opd_console.document.write(\' border-width: 1px;\');
opd_console.document.write(\' border-color: #ffffff #e4e4e4 #e4e4e4 #ffffff;\');
opd_console.document.write(\' border-style: solid;\');
opd_console.document.write(\' background-color: #efefef;\');
opd_console.document.write(\' font-size: 11px;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#queries{\');
opd_console.document.write(\' width: 100%;\');
opd_console.document.write(\' padding: 0;\');
opd_console.document.write(\' margin: 0;\');
opd_console.document.write(\' margin-top: 4px;\');
opd_console.document.write(\' border-spacing: 0;\');
opd_console.document.write(\' border: 1px #333333 solid;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#queries thead td{\');
opd_console.document.write(\' text-align: left;\');
opd_console.document.write(\' padding: 3px 3px 3px 12px;\');
opd_console.document.write(\' font-size: 12px;\');
opd_console.document.write(\' color: #474747;\');
opd_console.document.write(\' border-width: 1px 0 1px 0;\');
opd_console.document.write(\' border-style: solid;\');
opd_console.document.write(\' border-color: #ffffff #ffffff #b2b2b2 #ffffff;\');
opd_console.document.write(\' background-color: #dadada;\');
opd_console.document.write(\' font-weight: bold;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#queries tbody td{\');
opd_console.document.write(\' background-color: #f5f5f5;\');
opd_console.document.write(\' border-width: 0 1px 1px 0;\');
opd_console.document.write(\' border-style: solid;\');
opd_console.document.write(\' border-bottom-color: #d2d2d2;\');
opd_console.document.write(\' border-right-color: #d2d2d2;\');
opd_console.document.write(\' font-size: 10px;\');
opd_console.document.write(\' margin-top: 3px;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#queries tbody tr.cached td{\');
opd_console.document.write(\' background: #ededff;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'</style>\');
opd_console.document.write(\'</head>\');
opd_console.document.write(\'<body>\');
opd_console.document.write(\'<h1>OPD Debug Console</h1>\');
opd_console.document.write(\'<table id="info">\');
';
foreach($config as $name => $value)
{
$debugCode .= 'opd_console.document.write(\'<tr>\');
opd_console.document.write(\'<td class="field">'.$name.'</td>\');
opd_console.document.write(\'<td class="value">'.$value.'</td>\');
opd_console.document.write(\'</tr>\');';
}
$debugCode .= '
opd_console.document.write(\'</table>\');
opd_console.document.write(\'<table id="queries">\');
opd_console.document.write(\'<thead>\');
opd_console.document.write(\'<tr>\');
opd_console.document.write(\' <td>Query</td>\');
opd_console.document.write(\' <td>Cache</td>\');
opd_console.document.write(\' <td>Result</td>\');
opd_console.document.write(\' <td>Execution time</td>\');
opd_console.document.write(\'</tr>\');
opd_console.document.write(\'</thead>\');
opd_console.document.write(\'<tbody>\');
';
foreach($this -> queryMonitor as $data)
{
if($data['cached'] == true)
{
$debugCode .= 'opd_console.document.write(\'<tr class="cached">\');';
}
else
{
$debugCode .= 'opd_console.document.write(\'<tr>\');';
}
$debugCode .= 'opd_console.document.write(\' <td>'.addslashes($data['query']).'</td>\');
opd_console.document.write(\' <td>'.$data['cache'].'</td>\');
opd_console.document.write(\' <td>'.$data['result'].'</td>\');
opd_console.document.write(\' <td>'.$data['execution'].' s</td>\');
opd_console.document.write(\'</tr>\');';
}
$debugCode .= '
opd_console.document.write(\'</tbody>\');
opd_console.document.write(\'</table>\');
opd_console.document.write(\'\');
opd_console.document.write(\'</body>\');
opd_console.document.write(\'</html>\');';

629
autoload/opd.statement.php Normal file
View File

@@ -0,0 +1,629 @@
<?php
// -------------------------------------------------------------------- //
// Open Power Board //
// Open Power Driver //
// Copyright (c) 2005 OpenPB team, http://www.openpb.net/ //
// -------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU Lesser General Public License as //
// published by the Free Software Foundation; either version 2.1 of the //
// License, or (at your option) any later version. //
// -------------------------------------------------------------------- //
//
// $Id: opd.statement.php 49 2006-04-22 06:46:19Z zyxist $
interface iopdStatement
{
public function bindColumn($column, &$param, $type = NULL);
public function bindParam($parameter, &$variable, $dataType = NULL, $length = NULL, $driverOptions = NULL);
public function bindValue($parameter, $value, $dataType = NULL);
public function closeCursor();
public function columnCount();
public function errorCode();
public function errorInfo();
public function execute($inputParameters = array());
public function fetch($fetchStyle = PDO::FETCH_BOTH, $orientation = PDO::FETCH_ORI_NEXT, $offset = NULL);
public function fetchAll($fetchStyle = PDO::FETCH_BOTH, $columnIndex = 0);
public function fetchColumn($columnNumber = 0);
public function getAttribute($attribute);
public function getColumnMeta($column);
public function nextRowset();
public function rowCount();
public function setAttribute($attribute, $value);
public function setFetchMode($mode, $className = NULL);
}
class opdStatement implements iopdStatement, Iterator
{
private $stmt;
private $opd;
private $items;
private $query;
private $buffer;
private $i;
public function __construct(opdClass $opd, PDOStatement $stmt, $query = NULL)
{
$this -> stmt = $stmt;
$this -> opd = $opd;
$this -> query = $query;
} // end __construct();
public function bindColumn($column, &$param, $type = NULL)
{
if($type == NULL)
{
return $this -> stmt -> bindColumn($column, $param);
}
return $this -> stmt -> bindColumn($column, $param, $type);
} // end bindColumn();
public function bindParam($parameter, &$variable, $dataType = NULL, $length = NULL, $driverOptions = NULL)
{
if($dataType == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable);
}
elseif($length == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable, $dataType);
}
elseif($driverOptions == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable, $dataType, $length);
}
return $this -> stmt -> bindParam($parameter, $variable, $dataType, $length, $driverOptions);
} // end bindParam();
public function bindValue($parameter, $value, $dataType = NULL)
{
if($dataType == NULL)
{
return $this -> stmt -> bindValue($parameter, $value);
}
return $this -> stmt -> bindValue($parameter, $value, $dataType);
} // end bindValue();
public function closeCursor()
{
$this -> opd -> endDebugDefinition($this -> items);
return $this -> stmt -> closeCursor();
} // end closeCursor();
public function columnCount()
{
return $this -> stmt -> columnCount();
} // end columnCount();
public function errorCode()
{
return $this -> stmt -> errorCode();
} // end errorCode();
public function errorInfo()
{
return $this -> stmt -> errorInfo();
} // end errorInfo();
public function execute($inputParameters = NULL)
{
if($inputParameters == NULL)
{
$this -> opd -> beginDebugDefinition($this -> query);
$this -> opd -> startTimer(false, false);
$result = $this -> stmt -> execute();
$this -> opd -> endTimer();
}
else
{
$this -> opd -> beginDebugDefinition($this -> query);
$this -> opd -> startTimer(false, false);
$result = $this -> stmt -> execute($inputParameters);
$this -> opd -> endTimer();
}
$this -> items = 0;
$letter = strtolower($this->query[0]);
if($letter == 'i' || $letter == 'u' || $letter == 'd' || $letter == 'r')
{
$this -> items = $this -> stmt -> rowCount();
$this -> opd -> endDebugDefinition($this -> items);
}
return $result;
} // end execute();
public function fetch($fetchStyle = PDO::FETCH_BOTH, $orientation = PDO::FETCH_ORI_NEXT, $offset = NULL)
{
if($offset == NULL)
{
if($data = $this -> stmt -> fetch($fetchStyle, $orientation))
{
$this -> items++;
return $data;
}
}
if($data = $this -> stmt -> fetch($fetchStyle, $orientation, $offset))
{
$this -> items++;
return $data;
}
} // end fetch();
public function fetchAll($fetchStyle = PDO::FETCH_BOTH, $columnIndex = 0)
{
if($fetchStyle == PDO::FETCH_COLUMN)
{
$data = $this -> stmt -> fetchAll($fetchStyle, $columnIndex);
}
else
{
$data = $this -> stmt -> fetchAll($fetchStyle);
}
$this -> items = count($data);
return $data;
} // end fetchAll();
public function fetchColumn($columnNumber = 0)
{
$this -> items++;
return $this -> stmt -> fetchColumn($columnNumber);
} // end fetchColumn();
public function getAttribute($attribute)
{
return $this -> stmt -> getAttribute($attribute);
} // end getAttribute();
public function getColumnMeta($column)
{
return $this -> stmt -> getColumnMeta($column);
} // end getColumnMeta();
public function nextRowset()
{
$this -> items++;
return $this -> stmt -> nextRowset();
} // end nextRowset();
public function rowCount()
{
return $this -> stmt -> rowCount();
} // end rowCount();
public function setAttribute($attribute, $value)
{
return $this -> stmt -> setAttribute($attribute, $value);
} // end setAttribute();
public function setFetchMode($mode, $className = NULL, $args = array())
{
if($mode == PDO::FETCH_CLASS)
{
return $this -> stmt -> setFetchMode($mode, $className, $args);
}
return $this -> stmt -> setFetchMode($mode);
} // end setFetchMode();
public function rowNumber()
{
return $this -> items;
} // end rowNumber();
/*
* ITERATOR INTERFACE IMPLEMENTATION
*/
public function current()
{
return $this -> buffer;
} // end current();
public function key()
{
return $this -> i;
} // end key();
public function valid()
{
if($this -> buffer = $this -> stmt -> fetch())
{
return true;
}
$this -> items = $this -> i - 1;
$this -> stmt -> closeCursor();
return false;
} // end valid();
public function next()
{
$this -> i++;
} // end next();
public function rewind()
{
$this -> buffer = array();
$this -> i = 0;
} // end rewind();
}
class opdCachedStatement implements iopdStatement, Iterator
{
protected $stmt;
protected $opd;
protected $cache;
protected $cacheId;
protected $cacheDir;
protected $data;
protected $i;
public function __construct(opdClass $opd, $cacheStatus, $param2 = NULL, $param3 = NULL)
{
$this -> opd = $opd;
$this -> cache = $cacheStatus;
$this -> cacheDir = $this -> opd -> getCacheDirectory();
if($this -> cache)
{
$this -> cacheId = $param2;
if($this -> cacheId != NULL)
{
$this -> opd -> startTimer(true, true);
$this -> data = unserialize(file_get_contents($this->cacheDir.'%%'.$this->cacheId.'.php'));
$this -> opd -> endTimer();
}
}
else
{
$this -> cacheId = $param3;
$this -> stmt = $param2;
}
// set the cursor at the starting position
$this -> i = 0;
} // end __construct();
public function bindColumn($column, &$param, $type = NULL)
{
return false;
} // end bindColumn();
public function bindParam($parameter, &$variable, $dataType = NULL, $length = NULL, $driverOptions = NULL)
{
return false;
} // end bindParam();
public function bindValue($parameter, $value, $dataType = NULL)
{
return false;
} // end bindValue();
public function closeCursor()
{
$this -> opd -> endDebugDefinition(count($this -> data));
if(!$this -> cache)
{
file_put_contents($this->cacheDir.'%%'.$this->cacheId.'.php', serialize($this->data));
return $this -> stmt -> closeCursor();
}
return 1;
} // end closeCursor();
public function columnCount()
{
return $this -> stmt -> columnCount();
} // end columnCount();
public function errorCode()
{
return $this -> stmt -> errorCode();
} // end errorCode();
public function errorInfo()
{
return $this -> stmt -> errorInfo();
} // end errorInfo();
public function execute($inputParameters = NULL)
{
return false;
} // end execute();
public function fetch($fetchStyle = PDO::FETCH_ASSOC, $orientation = PDO::FETCH_ORI_NEXT, $offset = NULL)
{
if(!$this -> cache)
{
if($offset == NULL)
{
if($data = $this -> stmt -> fetch($fetchStyle, $orientation))
{
$this -> data[$this->i] = $data;
$this -> i++;
return $data;
}
}
else
{
if($data = $this -> stmt -> fetch($fetchStyle, $orientation, $offset))
{
$this -> data[$this->i] = $data;
$this -> i++;
return $data;
}
}
}
else
{
if(isset($this->data[$this->i]))
{
return $this->data[$this->i++];
}
}
} // end fetch();
public function fetchAll($fetchStyle = PDO::FETCH_BOTH, $columnIndex = 0)
{
if(!$this -> cache)
{
if($fetchStyle == PDO::FETCH_COLUMN)
{
return $this -> data = $this -> stmt -> fetchAll($fetchStyle, $columnIndex);
}
else
{
return $this -> data = $this -> stmt -> fetchAll($fetchStyle);
}
}
else
{
return $this -> data;
}
} // end fetchAll();
public function fetchColumn($columnNumber = 1)
{
if(!$this -> cache)
{
return $this -> data[$this->i++] = $this -> stmt -> fetchColumn($columnNumber);
}
else
{
return $this -> data[$this->i++];
}
} // end fetchColumn();
public function getAttribute($attribute)
{
return $this -> stmt -> getAttribute($attribute);
} // end getAttribute();
public function getColumnMeta($column)
{
return $this -> stmt -> getColumnMeta($column);
} // end getColumnMeta();
public function nextRowset()
{
return $this -> stmt -> nextRowset();
} // end nextRowset();
public function rowCount()
{
return $this -> stmt -> rowCount();
} // end rowCount();
public function setAttribute($attribute, $value)
{
return $this -> stmt -> setAttribute($attribute, $value);
} // end setAttribute();
public function setFetchMode($mode, $className = NULL)
{
if($this -> cache)
{
return 1;
}
if($mode == PDO::FETCH_CLASS)
{
return $this -> stmt -> setFetchMode($mode, $className);
}
return $this -> stmt -> setFetchMode($mode);
} // end setFetchMode();
public function setCache($id)
{
$this -> cacheId = $id;
} // end setCache();
/*
* ITERATOR INTERFACE IMPLEMENTATION
*/
public function current()
{
return $this -> data[$this->i-1];
} // end current();
public function key()
{
return $this -> i - 1;
} // end key();
public function valid()
{
if($this -> fetch())
{
return true;
}
$this -> closeCursor();
return false;
} // end valid();
public function next()
{
} // end next();
public function rewind()
{
} // end rewind();
}
class opdPreparedCacheStatement extends opdCachedStatement
{
private $j;
private $cacheIds;
public function __construct(opdClass $opd, Array $itemList, $stmt, $query)
{
$this -> query = $query;
$this -> opd = $opd;
$this -> cacheDir = $this -> opd -> getCacheDirectory();
$this -> cacheIds = $itemList;
$this -> stmt = $stmt;
// set the cursor at the starting position
$this -> i = 0;
$this -> j = 0;
$this -> cache = $this -> cacheIds[$this->j]['test'];
} // end __construct();
public function execute($inputParameters = NULL)
{
if(!isset($this -> cacheIds[$this->j]['test']))
{
return false;
}
$this -> opd -> beginDebugDefinition($this -> query);
$this -> i = 0;
if($this -> cacheIds[$this->j]['test'] == true)
{
$this -> cache = true;
$this -> cacheId = $this -> cacheIds[$this->j]['id'];
$this -> opd -> startTimer(true, true);
$this -> data = unserialize(file_get_contents($this->cacheDir.'%%'.$this->cacheId.'.php'));
$this -> opd -> endTimer();
}
else
{
$this -> cache = false;
$this -> cacheId = $this -> cacheIds[$this->j]['id'];
$this -> data = array();
if($inputParameters == NULL)
{
$this -> opd -> startTimer(true, false);
$result = $this -> stmt -> execute();
$this -> opd -> endTimer();
}
else
{
$this -> opd -> startTimer(true, false);
$result = $this -> stmt -> execute($inputParameters);
$this -> opd -> endTimer();
}
return $result;
}
} // end execute();
public function bindColumn($column, &$param, $type = NULL)
{
if(!$this -> cache)
{
if($type == NULL)
{
return $this -> stmt -> bindColumn($column, $param);
}
return $this -> stmt -> bindColumn($column, $param, $type);
}
return true;
} // end bindColumn();
public function bindParam($parameter, &$variable, $dataType = NULL, $length = NULL, $driverOptions = NULL)
{
if(!$this -> cache)
{
if($dataType == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable);
}
elseif($length == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable, $dataType);
}
elseif($driverOptions == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable, $dataType, $length);
}
return $this -> stmt -> bindParam($parameter, $variable, $dataType, $length, $driverOptions);
}
return true;
} // end bindParam();
public function bindValue($parameter, $value, $dataType = NULL)
{
if(!$this -> cache)
{
if($dataType == NULL)
{
return $this -> stmt -> bindValue($parameter, $value);
}
return $this -> stmt -> bindValue($parameter, $value, $dataType);
}
return true;
} // end bindValue();
public function closeCursor()
{
if($this -> cacheId == false)
{
$this -> opd -> endDebugDefinition($this -> i);
return $this -> stmt -> closeCursor();
}
$result = parent::closeCursor();
$this -> j++;
if(isset($this -> cacheIds[$this->j]))
{
$this -> cache = $this -> cacheIds[$this->j]['test'];
}
return $result;
} // end closeCursor();
public function fetch($fetchStyle = PDO::FETCH_ASSOC, $orientation = PDO::FETCH_ORI_NEXT, $offset = NULL)
{
if($this -> cacheId == false)
{
return $this -> stmt -> fetch($fetchStyle, $orientation, $offset);
}
return parent::fetch($fetchStyle, $orientation, $offset);
} // end fetch();
public function fetchAll($fetchStyle = PDO::FETCH_BOTH, $columnIndex = 0)
{
if($fetchStyle == PDO::FETCH_COLUMN)
{
if($this -> cacheId == false)
{
return $this -> stmt -> fetch($fetchStyle, $columnIndex);
}
return parent::fetchAll($fetchStyle, $columnIndex);
}
else
{
if($this -> cacheId == false)
{
return $this -> stmt -> fetch($fetchStyle);
}
return parent::fetchAll($fetchStyle);
}
} // end fetchAll();
public function fetchColumn($columnNumber = 1)
{
if($this -> cacheId == false)
{
return $this -> stmt -> fetch($columnNumber);
}
return parent::fetchColumn($columnNumber);
} // end fetchColumn();
}
?>

125
autoload/savant3/Error.php Normal file
View File

@@ -0,0 +1,125 @@
<?php
/**
*
* Provides a simple error class for Savant.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Error.php,v 1.5 2005/05/27 14:03:50 pmjones Exp $
*
*/
/**
*
* Provides a simple error class for Savant.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Error {
/**
*
* The error code, typically a Savant 'ERR_*' string.
*
* @access public
*
* @var string
*
*/
public $code = null;
/**
*
* An array of error-specific information.
*
* @access public
*
* @var array
*
*/
public $info = array();
/**
*
* The error severity level.
*
* @access public
*
* @var int
*
*/
public $level = E_USER_ERROR;
/**
*
* A debug backtrace for the error, if any.
*
* @access public
*
* @var array
*
*/
public $trace = null;
/**
*
* Constructor.
*
* @access public
*
* @param array $conf An associative array where the key is a
* Savant3_Error property and the value is the value for that
* property.
*
*/
public function __construct($conf = array())
{
// set public properties
foreach ($conf as $key => $val) {
$this->$key = $val;
}
// add a backtrace
if ($conf['trace'] === true) {
$this->trace = debug_backtrace();
}
}
/**
*
* Magic method for output dump.
*
* @access public
*
* @return void
*/
public function __toString()
{
ob_start();
echo get_class($this) . ': ';
print_r(get_object_vars($this));
return ob_get_clean();
}
}
?>

View File

@@ -0,0 +1,29 @@
<?php
/**
*
* Throws PHP5 exceptions for Savant.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Exception.php,v 1.1 2005/05/27 14:04:36 pmjones Exp $
*
*/
/**
*
* A simple Savant3_Exception class.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Exception extends Exception {
}
?>

View File

@@ -0,0 +1,85 @@
<?php
/**
*
* Abstract Savant3_Filter class.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Filter.php,v 1.5 2005/04/29 16:23:50 pmjones Exp $
*
*/
/**
*
* Abstract Savant3_Filter class.
*
* You have to extend this class for it to be useful; e.g., "class
* Savant3_Filter_example extends Savant3_Filter".
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
abstract class Savant3_Filter {
/**
*
* Optional reference to the calling Savant object.
*
* @access protected
*
* @var object
*
*/
protected $Savant = null;
/**
*
* Constructor.
*
* @access public
*
* @param array $conf An array of configuration keys and values for
* this filter.
*
* @return void
*
*/
public function __construct($conf = null)
{
settype($conf, 'array');
foreach ($conf as $key => $val) {
$this->$key = $val;
}
}
/**
*
* Stub method for extended behaviors.
*
* @access public
*
* @param string $text The text buffer to filter.
*
* @return string The text buffer after it has been filtered.
*
*/
public static function filter($text)
{
return $text;
}
}
?>

View File

@@ -0,0 +1,67 @@
<?php
/**
*
* Abstract Savant3_Plugin class.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Plugin.php,v 1.5 2005/04/29 16:23:50 pmjones Exp $
*
*/
/**
*
* Abstract Savant3_Plugin class.
*
* You have to extend this class for it to be useful; e.g., "class
* Savant3_Plugin_example extends Savant2_Plugin". Be sure to add a
* method named for the plugin itself; e.g., "function example()".
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
abstract class Savant3_Plugin {
/**
*
* Reference to the calling Savant object.
*
* @access protected
*
* @var object
*
*/
protected $Savant = null;
/**
*
* Constructor.
*
* @access public
*
* @param array $conf An array of configuration keys and values for
* this plugin.
*
* @return void
*
*/
public function __construct($conf = null)
{
settype($conf, 'array');
foreach ($conf as $key => $val) {
$this->$key = $val;
}
}
}
?>

View File

@@ -0,0 +1,147 @@
<?php
/**
*
* Filter to remove extra white space within the text.
*
* @package Savant3
*
* @author Monte Ohrt <monte@ispi.net>
*
* @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
*
* @author Converted to a Savant3 filter by Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Savant3_Filter_trimwhitespace.php,v 1.4 2005/05/29 15:27:07 pmjones Exp $
*
*/
/**
*
* Filter to remove extra white space within the text.
*
* @package Savant3
*
* @author Monte Ohrt <monte@ispi.net>
*
* @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
*
* @author Converted to a Savant3 filter by Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Filter_trimwhitespace extends Savant3_Filter {
/**
*
* Removes extra white space within the text.
*
* Trim leading white space and blank lines from template source
* after it gets interpreted, cleaning up code and saving bandwidth.
* Does not affect <pre></pre>, <script></script>, or
* <textarea></textarea> blocks.
*
* @access public
*
* @param string $buffer The source text to be filtered.
*
* @return string The filtered text.
*
*/
public static function filter($buffer)
{
// Pull out the script blocks
preg_match_all("!<script[^>]+>.*?</script>!is", $buffer, $match);
$script_blocks = $match[0];
$buffer = preg_replace(
"!<script[^>]+>.*?</script>!is",
'@@@SAVANT:TRIM:SCRIPT@@@',
$buffer
);
// Pull out the pre blocks
preg_match_all("!<pre[^>]*>.*?</pre>!is", $buffer, $match);
$pre_blocks = $match[0];
$buffer = preg_replace(
"!<pre[^>]*>.*?</pre>!is",
'@@@SAVANT:TRIM:PRE@@@',
$buffer
);
// Pull out the textarea blocks
preg_match_all("!<textarea[^>]+>.*?</textarea>!is", $buffer, $match);
$textarea_blocks = $match[0];
$buffer = preg_replace(
"!<textarea[^>]+>.*?</textarea>!is",
'@@@SAVANT:TRIM:TEXTAREA@@@',
$buffer
);
// remove all leading spaces, tabs and carriage returns NOT
// preceeded by a php close tag.
$buffer = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $buffer));
// replace script blocks
Savant3_Filter_trimwhitespace::replace(
"@@@SAVANT:TRIM:SCRIPT@@@",
$script_blocks,
$buffer
);
// replace pre blocks
Savant3_Filter_trimwhitespace::replace(
"@@@SAVANT:TRIM:PRE@@@",
$pre_blocks,
$buffer
);
// replace textarea blocks
Savant3_Filter_trimwhitespace::replace(
"@@@SAVANT:TRIM:TEXTAREA@@@",
$textarea_blocks,
$buffer
);
return $buffer;
}
/**
*
* Does a simple search-and-replace on the source text.
*
* @access protected
*
* @param string $search The string to search for.
*
* @param string $replace Replace with this text.
*
* @param string &$buffer The source text.
*
* @return string The text after search-and-replace.
*
*/
protected static function replace($search, $replace, &$buffer)
{
$len = strlen($search);
$pos = 0;
$count = count($replace);
for ($i = 0; $i < $count; $i++) {
// does the search-string exist in the buffer?
$pos = strpos($buffer, $search, $pos);
if ($pos !== false) {
// replace the search-string
$buffer = substr_replace($buffer, $replace[$i], $pos, $len);
} else {
break;
}
}
}
}
?>

View File

@@ -0,0 +1,109 @@
<?php
/**
*
* Generates an <a href="">...</a> tag.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Savant3_Plugin_ahref.php,v 1.4 2005/08/09 12:56:14 pmjones Exp $
*
*/
/**
*
* Generates an <a href="">...</a> tag.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Plugin_ahref extends Savant3_Plugin {
/**
*
* Generate an HTML <a href="">...</a> tag.
*
* @access public
*
* @param string|array $href A string URL for the resulting tag. May
* also be an array with any combination of the keys 'scheme',
* 'host', 'path', 'query', and 'fragment' (c.f. PHP's native
* parse_url() function).
*
* @param string $text The displayed text of the link.
*
* @param string|array $attr Any extra attributes for the <a> tag.
*
* @return string The <a href="">...</a> tag.
*
*/
public function ahref($href, $text, $attr = null)
{
$html = '<a href="';
if (is_array($href)) {
// add the HREF from an array
$tmp = '';
if (isset($href['scheme'])) {
$tmp .= $href['scheme'] . ':';
if (strtolower($href['scheme']) != 'mailto') {
$tmp .= '//';
}
}
if (isset($href['host'])) {
$tmp .= $href['host'];
}
if (isset($href['path'])) {
$tmp .= $href['path'];
}
if (isset($href['query'])) {
$tmp .= '?' . $href['query'];
}
if (isset($href['fragment'])) {
$tmp .= '#' . $href['fragment'];
}
$html .= htmlspecialchars($tmp);
} else {
// add the HREF from a scalar
$html .= htmlspecialchars($href);
}
$html .= '"';
// add attributes
if (is_array($attr)) {
// from array
foreach ($attr as $key => $val) {
$key = htmlspecialchars($key);
$val = htmlspecialchars($val);
$html .= " $key=\"$val\"";
}
} elseif (! is_null($attr)) {
// from scalar
$html .= htmlspecialchars(" $attr");
}
// set the link text, close the tag, and return
$html .= '>' . $text . '</a>';
return $html;
}
}
?>

View File

@@ -0,0 +1,63 @@
<?php
/**
*
* Plugin to convert an associative array to a string of tag attributes.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Savant3_Plugin_htmlAttribs.php,v 1.3 2005/09/12 17:49:27 pmjones Exp $
*
*/
/**
*
* Plugin to convert an associative array to a string of tag attributes.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Plugin_htmlAttribs extends Savant3_Plugin {
/**
*
* Converts an associative array to a string of tag attributes.
*
* @access public
*
* @param array $attribs From this array, each key-value pair is
* converted to an attribute name and value.
*
* @return string The XHTML for the attributes.
*
*/
public function htmlAttribs($attribs)
{
$xhtml = '';
foreach ((array) $attribs as $key => $val) {
if ($val === null) {
continue;
}
if (is_array($val)) {
$val = implode(' ', $val);
}
$key = htmlspecialchars($key);
$val = htmlspecialchars($val);
$xhtml .= " $key=\"$val\"";
}
return $xhtml;
}
}
?>

View File

@@ -0,0 +1,199 @@
<?php
/**
*
* Plugin to generate an <img ... /> tag.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Savant3_Plugin_image.php,v 1.7 2005/08/12 14:34:09 pmjones Exp $
*
*/
/**
*
* Plugin to generate an <img ... /> tag.
*
* Support for alpha transparency of PNG files in Microsoft IE added by
* Edward Ritter; thanks, Edward.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Plugin_image extends Savant3_Plugin {
/**
*
* The document root.
*
* @access public
*
* @var string
*
*/
protected $documentRoot = null;
/**
*
* The base directory for images within the document root.
*
* @access public
*
* @var string
*
*/
protected $imageDir = null;
/**
*
* Outputs an <img ... /> tag.
*
* Microsoft IE alpha PNG support added by Edward Ritter.
*
* @access public
*
* @param string $file The path to the image on the local file system
* relative to $this->imageDir.
*
* @param string $alt Alternative descriptive text for the image;
* defaults to the filename of the image.
*
* @param int $border The border width for the image; defaults to zero.
*
* @param int $width The displayed image width in pixels; defaults to
* the width of the image.
*
* @param int $height The displayed image height in pixels; defaults to
* the height of the image.
*
* @return string An <img ... /> tag.
*
*/
public function image($file, $alt = null, $height = null, $width = null,
$attr = null)
{
// is the document root set?
if (is_null($this->documentRoot) && isset($_SERVER['DOCUMENT_ROOT'])) {
// no, so set it
$this->documentRoot = $_SERVER['DOCUMENT_ROOT'];
}
// make sure there's a DIRECTORY_SEPARATOR between the docroot
// and the image dir
if (substr($this->documentRoot, -1) != DIRECTORY_SEPARATOR &&
substr($this->imageDir, 0, 1) != DIRECTORY_SEPARATOR) {
$this->documentRoot .= DIRECTORY_SEPARATOR;
}
// make sure there's a separator between the imageDir and the
// file name
if (substr($this->imageDir, -1) != DIRECTORY_SEPARATOR &&
substr($file, 0, 1) != DIRECTORY_SEPARATOR) {
$this->imageDir .= DIRECTORY_SEPARATOR;
}
// the image file type code (PNG = 3)
$type = null;
// get the file information
$info = false;
if (strpos($file, '://') === false) {
// no "://" in the file, so it's local
$file = $this->imageDir . $file;
$tmp = $this->documentRoot . $file;
$info = @getimagesize($tmp);
} else {
// don't attempt to get file info from streams, it takes
// way too long.
$info = false;
}
// did we find the file info?
if (is_array($info)) {
// capture type info regardless
$type = $info[2];
// capture size info where both not specified
if (is_null($width) && is_null($height)) {
$width = $info[0];
$height = $info[1];
}
}
// clean up
unset($info);
// is the file a PNG? if so, check user agent, we will need to
// make special allowances for Microsoft IE.
if (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && $type === 3) {
// support alpha transparency for PNG files in MSIE
$html = '<span style="position: relative;';
if ($height) {
$html .= ' height: ' . $height . 'px;';
}
if ($width) {
$html .= ' width: ' . $width . 'px;';
}
$html .= ' filter:progid:DXImageTransform.Microsoft.AlphaImageLoader';
$html .= "(src='" . htmlspecialchars($file) . "',sizingMethod='scale');\"";
$html .= ' title="' . htmlspecialchars($alt) . '"';
$html .= $this->Savant->htmlAttribs($attr);
// done
$html .= '></span>';
} else {
// not IE, so build a normal image tag.
$html = '<img';
$html .= ' src="' . htmlspecialchars($file) . '"';
// add the alt attribute
if (is_null($alt)) {
$alt = basename($file);
}
$html .= ' alt="' . htmlspecialchars($alt) . '"';
// add the height attribute
if ($height) {
$html .= ' height="' . htmlspecialchars($height) . '"';
}
// add the width attribute
if ($width) {
$html .= ' width="' . htmlspecialchars($width) . '"';
}
$html .= $this->Savant->htmlAttribs($attr);
// done
$html .= ' />';
}
// done!
return $html;
}
}
?>

View File

@@ -0,0 +1,11 @@
<?php
namespace view;
class Cron
{
public static function main_view()
{
$tpl = new \Tpl;
return $tpl -> render( 'cron/main-view' );
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace view;
class Messages {
public function drawMessages()
{
$tpl = new \Savant3;
$tpl -> _messages = \factory\Messages::getMessages();
return $tpl -> fetch( 'other/massages' );
}
}
?>

View File

@@ -0,0 +1,33 @@
<?php
namespace view;
class Page
{
public static function unlogged()
{
$tpl = new \Tpl;
return $tpl -> render( 'page/unlogged-layout' );
}
public function show()
{
global $user;
if ( !\S::get_session( 'user' ) and \S::get( 'p' ) != 'cron' )
return \view\Page::unlogged();
$tpl = new \Savant3;
$tpl -> _content = \controls\Page::getContent();
$tpl -> _alert = \S::get_session( 'alert' );
$tpl -> _messages = \view\Messages::drawMessages();
$tpl -> _user = $user;
if ( $user['type'] == 'client' or $user['type'] == 'worker' )
return $tpl -> fetch( 'client/main-layout' );
if ( $user['type'] == 'reseller' )
return $tpl -> fetch( 'reseller/main-layout' );
else
return $tpl -> fetch( 'page/main-layout' );
}
}
?>

View File

@@ -0,0 +1,20 @@
<?php
namespace view;
class PagePanel {
public function show( $add = false , $save = false , $cancel = false , $form = 'formularz' , $back = false , $update = false , $save_ajax = false, $checkbox = false )
{
$tpl = new \Savant3();
$tpl -> _add = $add;
$tpl -> _save = $save;
$tpl -> _cancel = $cancel;
$tpl -> _id_form = $form;
$tpl -> _back = $back;
$tpl -> _update = $update;
$tpl -> _save_ajax = $save_ajax;
$tpl -> _checkbox = $checkbox;
return $tpl -> fetch( 'other/page-panel' );
}
}
?>

View File

@@ -0,0 +1,139 @@
<?php
namespace view;
class Ranker
{
public function drawReportsForm()
{
$tpl = new \Savant3;
$tpl -> _sites = \factory\Ranker::getSites();
return $tpl -> fetch( 'ranker/reports' );
}
public function drawSummary( $month = '', $year = '' )
{
if ( $month ) \S::set_session( 'drawSitesList:month', $month );
if ( $year ) \S::set_session( 'drawSitesList:year', $year );
$month = \S::get_session( 'drawSitesList:month' );
$year = \S::get_session( 'drawSitesList:year' );
if ( !$month ) $month = date( 'm' );
if ( !$year ) $year = date( 'Y' );
$tpl = new \Savant3;
$tpl -> _profit = \factory\Ranker::getMonthProfit( $month, $year );
$tpl -> _clients = \factory\Ranker::getClientsSitesSummary( $month, $year );
$tpl -> _month = $month;
$tpl -> _year = $year;
return $tpl -> fetch( 'ranker/summary' );
}
public function phrase_costs_edit( $site_id, $phrase_id )
{
$tpl = new \Savant3;
$tpl -> site_id = $site_id;
$tpl -> phrase = \factory\Ranker::getPhrase( $phrase_id );
$tpl -> prices = \factory\Ranker::getPhrasePrices( $phrase_id );
return $tpl -> fetch( 'ranker/phrase-costs-edit' );
}
public function drawClientEdit( $id = '' )
{
$tpl = new \Savant3;
$tpl -> _client = \factory\Ranker::getClient( $id );
$tpl -> _sites = \factory\Ranker::getSites();
return $tpl -> fetch( 'ranker/client-edit' );
}
public function drawClientList()
{
$tpl = new \Tpl;
return $tpl -> render( 'ranker/client-list' );
$out = \view\PagePanel::show( true, false, false, 'Dodaj klienta' );
$type[0] = 'klient';
$type[1] = 'reseller';
$dbrowse = new \DataBrowse( 'pro_rr_clients' );
$dbrowse -> addPosition( 'login', 'Login', '', '', '', true );
$dbrowse -> addPosition( 'password', 'Hasło', '', '', '', true );
$dbrowse -> addPosition( 'enabled', 'Aktywny', '', \S::getComboYesNo(), 'text-align: center;' );
$dbrowse -> addPosition( 'last_logged', 'Ost. logowanie', '', '', 'text-align: center;', 'last_logged' );
$dbrowse -> addPosition( 'type', 'Typ', '', $type, 'text-align: center;' );
$dbrowse -> addPositionSimple( 'edytuj' , 'Edytuj' , './?rw=edit' );
$dbrowse -> addPositionSimple( 'usuń' , 'Usuń' , '' , \S::deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'last_logged DESC' );
$dbrowse -> addLp();
$dbrowse -> addFiltr( 'login', 'Login' );
$dbrowse -> addFiltr( 'enabled', 'Aktywny', \S::getComboYesNo() );
$dbrowse -> addFiltr( 'type', 'Typ', $type );
$dbrowse -> addMenu( $out );
return $dbrowse -> draw();
}
public function phrase_edit( $site_id, $phrase_id = '' )
{
$tpl = new \Tpl;
$tpl -> site_id = $site_id;
$tpl -> phrase = \factory\Ranker::getPhrase( $phrase_id );
$tpl -> sites = \factory\Ranker::getSites();
return $tpl -> render( 'ranker/phrase-edit' );
}
public static function main_view( $id = '', $month = '', $year = '' )
{
global $user;
if ( $user['type'] != 'admin' )
return false;
if ( $id !== null )
\S::set_session( 'ranker:main_view:id', $id );
if ( $month )
\S::set_session( 'ranker:main_view:month', $month );
if ( $year )
\S::set_session( 'ranker:main_view:year', $year );
if ( !$month and !\S::get_session( 'ranker:main_view:month' ) )
{
$month = date( 'm' );
\S::set_session( 'ranker:main_view:month', $month );
}
if ( !$year and !\S::get_session( 'ranker:main_view:year' ) )
{
$year = date( 'Y' );
\S::set_session( 'ranker:main_view:year', $year );
}
$month = \S::get_session( 'ranker:main_view:month' );
$year = \S::get_session( 'ranker:main_view:year' );
$id = \S::get_session( 'ranker:main_view:id' );
if ( !$id )
$id = \factory\Ranker::first_site_id();
$site = \factory\Ranker::site_details( $id );
$tpl = new \Tpl;
$tpl -> day_profit = \factory\Ranker::day_profit();
$tpl -> month_profit = \factory\Ranker::getMonthProfit( $month, $year );
$tpl -> sites = \factory\Ranker::sites_list();
$tpl -> phrases = \factory\Ranker::site_phrases_details( $site['id'], $month, $year, '', '', $user['login'] );
$tpl -> next_site_id = \factory\Ranker::next_site_id( $site['id'] );
$tpl -> prev_site_id = \factory\Ranker::prev_site_id( $site['id'] );
$tpl -> majestic = \factory\Ranker::majestic( $site['id'] );
$tpl -> semstorm = \factory\Ranker::semstorm( $site['id'] );
$tpl -> comments = \factory\Ranker::site_comments( $site['id'], $month, $year );
$tpl -> site = $site;
$tpl -> month = $month;
$tpl -> year = $year;
$tpl -> sites_to_confirm = \factory\Ranker::sites_to_confirm();
return $tpl -> render( 'ranker/main-view' );
}
}
?>

View File

@@ -0,0 +1,85 @@
<?php
namespace view;
class RankerClients
{
public static function site_edit( $site_id )
{
$tpl = new \Savant3;
$tpl -> _site = \factory\Ranker::getSite( $site_id, 'ASC', true );
return $tpl -> fetch( 'client/site-edit' );
}
public function drawReportsForm()
{
global $user;
$tpl = new \Savant3;
$tpl -> _sites = \factory\RankerClients::getSites( $user['id'] );
return $tpl -> fetch( 'client/reports' );
}
public function drawSummary( $month = '', $year = '' )
{
global $user;
if ( $month ) \S::set_session( 'drawSitesList:month', $month );
if ( $year ) \S::set_session( 'drawSitesList:year', $year );
$month = \S::get_session( 'drawSitesList:month' );
$year = \S::get_session( 'drawSitesList:year' );
if ( !$month ) $month = date( 'm' );
if ( !$year ) $year = date( 'Y' );
$tpl = new \Savant3;
$tpl -> _sites = \factory\RankerClients::getSitesSummary( $month, $year, $user['id'], $user['login'] );
$tpl -> _month = $month;
$tpl -> _year = $year;
return $tpl -> fetch( 'client/ranker-summary' );
}
public function main_view( $id, $month = '', $year = '' )
{
global $user;
if ( $id !== null )
\S::set_session( 'ranker:main_view:id', $id );
if ( $month )
\S::set_session( 'ranker:main_view:month', $month );
if ( $year )
\S::set_session( 'ranker:main_view:year', $year );
if ( !$month and !\S::get_session( 'ranker:main_view:month' ) )
{
$month = date( 'm' );
\S::set_session( 'ranker:main_view:month', $month );
}
if ( !$year and !\S::get_session( 'ranker:main_view:year' ) )
{
$year = date( 'Y' );
\S::set_session( 'ranker:main_view:year', $year );
}
$month = \S::get_session( 'ranker:main_view:month' );
$year = \S::get_session( 'ranker:main_view:year' );
$id = \S::get_session( 'ranker:main_view:id' );
$site = \factory\RankerClients::getClientSite( $id, $user['id'] );
$tpl = new \Tpl;
$tpl -> sites = \factory\RankerClients::getClientSites( $user['id'] );
$tpl -> phrases = \factory\Ranker::getSitePhrases( $site['id'], $month, $year, false, $user['reseller_id'], $user['login'] );
$tpl -> comments = \factory\Ranker::site_comments( $site['id'], $month, $year );
$tpl -> site = $site;
$tpl -> month = $month;
$tpl -> year = $year;
$tpl -> next_site_id = \factory\RankerClients::getNextClientSiteId( $site['id'], $user['id'] );
$tpl -> prev_site_id = \factory\RankerClients::getPrevClientSiteId( $site['id'], $user['id'] );
return $tpl -> render( 'client/site-list' );
}
}
?>

View File

@@ -0,0 +1,101 @@
<?php
namespace view;
class RankerReseller {
public function drawReportsForm()
{
global $user;
$tpl = new \Savant3;
$tpl -> _sites = \factory\RankerReseller::getSites( $user['id'] );
return $tpl -> fetch( 'reseller/reports' );
}
public function drawSummary( $month = '', $year = '' )
{
global $user;
if ( $month ) \S::set_session( 'drawSitesList:month', $month );
if ( $year ) \S::set_session( 'drawSitesList:year', $year );
$month = \S::get_session( 'drawSitesList:month' );
$year = \S::get_session( 'drawSitesList:year' );
if ( !$month ) $month = date( 'm' );
if ( !$year ) $year = date( 'Y' );
$tpl = new \Savant3;
$tpl -> _sites = \factory\RankerReseller::getSitesSummary( $month, $year, $user['id'], $user['reseller_id'] );
$tpl -> _sites_res = \factory\RankerReseller::getSitesSummary( $month, $year, $user['id'], $user['id'] );
$tpl -> _month = $month;
$tpl -> _year = $year;
return $tpl -> fetch( 'reseller/ranker-summary' );
}
public function phraseEdit( $site_id, $phrase_id = '', $reseller_id )
{
$tpl = new \Savant3;
$tpl -> _site_id = $site_id;
$tpl -> _reseller_id = $reseller_id;
$tpl -> _phrase = \factory\Ranker::getPhrase( $phrase_id, $reseller_id);
return $tpl -> fetch( 'reseller/phrase-edit' );
}
public function editCosts( $site_id, $phrase_id, $reseller_id )
{
$tpl = new \Savant3;
$tpl -> _site_id = $site_id;
$tpl -> _reseller_id = $reseller_id;
$tpl -> _phrase = \factory\Ranker::getPhrase( $phrase_id );
$tpl -> _prices = \factory\Ranker::getPhrasePrices( $phrase_id, $reseller_id );
return $tpl -> fetch( 'reseller/costs-edit' );
}
public function drawSitesList( $id, $month = '', $year = '' )
{
global $user;
if ( $id ) \S::set_session( 'drawSitesList:id', $id );
if ( $month ) \S::set_session( 'drawSitesList:month', $month );
if ( $year ) \S::set_session( 'drawSitesList:year', $year );
$month = \S::get_session( 'drawSitesList:month' );
$year = \S::get_session( 'drawSitesList:year' );
$id = \S::get_session( 'drawSitesList:id' );
if ( !$month ) $month = date( 'm' );
if ( !$year ) $year = date( 'Y' );
$site = \factory\RankerClients::getClientSite( $id, $user['id'] );
$tpl = new \Savant3;
$tpl -> _sites = \factory\RankerClients::getClientSites( $user['id'] );
$tpl -> _phrases = \factory\Ranker::getSitePhrases( $site['id'], $month, $year, false, $user['reseller_id'], $user['login'] );
$tpl -> _phrases_reseller = \factory\Ranker::getSitePhrases( $site['id'], $month, $year, false, $user['id'], $user['login'] );
$tpl -> _site = $site;
$tpl -> _month = $month;
$tpl -> _year = $year;
$tpl -> _next_site_id = \factory\RankerClients::getNextClientSiteId( $site['id'], $user['id'] );
$tpl -> _prev_site_id = \factory\RankerClients::getPrevClientSiteId( $site['id'], $user['id'] );
return $tpl -> fetch( 'reseller/site-list' );
}
public function drawClientEdit( $id = '' )
{
global $user;
$tpl = new \Savant3;
$tpl -> _reseller_id = $user['id'];
$tpl -> _client = \factory\Ranker::getClient( $id );
$tpl -> _sites = \factory\RankerClients::getClientSites( $user['id'] );
return $tpl -> fetch( 'reseller/client-edit' );
}
public static function drawClientList()
{
$tpl = new \Tpl;
return $tpl -> render( 'reseller/client-list' );
}
}
?>

View File

@@ -0,0 +1,12 @@
<?php
namespace view;
class Settings {
public function drawSettings()
{
$tpl = new \Savant3;
return $tpl -> fetch( 'other/settings' );
}
}
?>

40
config.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
$config['db']['host'] = 'localhost';
$config['db']['user'] = 'admin_rank24';
$config['db']['password'] = 'JhFgfyqHrueGS5bYfsXn';
$config['db']['name'] = 'admin_rank24';
$config['site']['majestic_interval'] = 7;
$config['site']['semstorm_interval'] = 1;
$config['proxy']['sv-check'] = 2;
$config['proxy']['ht-check'] = 4;
$config['proxy']['s-version'] = 1.218;
$config['phrases']['max_recheck'] = 1;
$config['phrases']['admin_confirm'] = true;
$config['profit']['vat'] = 1.23;
$config['proxy']['grzesiek'] = false;
$config['proxy']['proxymarket'] = false;
$config['proxy']['proxymarket-api'] = 'http://www.proxymarket.pl/api/get/c1b0b3c462df287034733394722a1dfa8f72e014/';
$config['proxy']['adding-api'] = 'http://proxy.adding.pl/apiproxy/fb3e9dce39994cce12746cd0aaee2279.txt';
$config['proxy']['proxy-adding'] = false;
$config['organizer']['email'] = 'poczta@project-dc.pl';
$config['organizer']['months'] = array (
1 => 'Styczeń',
2 => 'Luty',
3 => 'Marzec',
4 => 'Kwiecień',
5 => 'Maj',
6 => 'Czerwiec',
7 => 'Lipiec',
8 => 'Sierpień',
9 => 'Wrzesień',
10 => 'Październik',
11 => 'Listopad',
12 => 'Grudzień' );

107
cron.php Normal file
View File

@@ -0,0 +1,107 @@
<?
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
function __autoload_my_classes( $classname )
{
$q = explode( '\\' , $classname );
$c = array_pop( $q );
$f = 'autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
if ( $c == 'Savant3' )
{
require_once 'autoload/Savant3.php';
return true;
}
if ( file_exists( $f ) )
require_once( $f );
}
spl_autoload_register( '__autoload_my_classes' );
mb_internal_encoding( "UTF-8" );
define( 'OPD_DIR' , 'autoload/' );
require_once OPD_DIR . 'opd.class.php';
require_once 'config.php';
require_once 'libraries/medoo.php';
require_once 'libraries/grid/config.php';
require_once 'resources/phpmailer/class.phpmailer.php';
include 'autoload/RestClient3.php';
date_default_timezone_set('Europe/Warsaw');
header( 'Content-Type: text/html; charset=utf-8' );
session_start();
$db = opdClass::create(
array(
'dsn' => 'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['name'],
'user' => $config['db']['user'] ,
'password' => $config['db']['password'] ,
'cache' => 'temp/' ,
'debugConsole' => $config['db']['debug']
)
);
$db -> query( 'SET NAMES utf8' );
$db -> query( 'UPDATE pro_rr_phrases SET ds_id = NULL WHERE ds_date != \'' . date( 'Y-m-d' ) . '\'' );
$mdb = new medoo( [
'database_type' => 'mysql',
'database_name' => $config['db']['name'],
'server' => $config['db']['host'],
'username' => $config['db']['user'],
'password' => $config['db']['password'],
'charset' => 'utf8'
] );
$mdb -> delete( 'pro_proxy', [ 'banned_count[>]' => 10 ] );
$mdb -> update( 'pro_proxy', [ 'is_banned' => 0, 'banned_date' => null ], [ 'AND' => [ 'is_banned' => 1, 'banned_date[<]' => date( "Y-m-d H:i:s" ) ] ] );
// $response = \Cron::check_phrases_positions_dfs();
// if ( $response['status'] == 'ok' )
// {
// echo json_encode( $response );
// exit;
// }
if ( date( 'G' ) > 1 )
{
$response = \Cron::post_phrases_positions_dfs3();
if ( $response['status'] == 'ok' )
{
echo json_encode( $response );
exit;
}
}
if ( date( 'G' ) > 1 )
{
$response = \Cron::get_phrases_positions_dfs3();
if ( $response['status'] == 'ok' )
{
echo json_encode( $response );
exit;
}
}
/* uzupełniam brakujące pozycje */
$response = \Cron::fill_missing_positions();
if ( $response['status'] == 'ok' )
{
echo json_encode( $response );
exit;
}
/* archiwizowanie starych pozycji */
$response = \Cron::archive_positions();
if ( $response['status'] == 'ok' )
{
echo json_encode( $response );
exit;
}
/* opróżnianie archiwum */
$response = \Cron::archive_empty();
if ( $response['status'] == 'ok' )
{
echo json_encode( $response );
exit;
}
echo json_encode( [ 'status' => 'empty' ] );

0
d4s.txt Normal file
View File

107
dsf.php Normal file
View File

@@ -0,0 +1,107 @@
<?
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
function __autoload_my_classes( $classname )
{
$q = explode( '\\' , $classname );
$c = array_pop( $q );
$f = 'autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
if ( $c == 'Savant3' )
{
require_once 'autoload/Savant3.php';
return true;
}
if ( file_exists( $f ) )
require_once( $f );
}
spl_autoload_register( '__autoload_my_classes' );
mb_internal_encoding( "UTF-8" );
define( 'OPD_DIR' , 'autoload/' );
require_once OPD_DIR . 'opd.class.php';
require_once 'config.php';
require_once 'libraries/medoo.php';
require_once 'libraries/grid/config.php';
require_once 'resources/phpmailer/class.phpmailer.php';
date_default_timezone_set('Europe/Warsaw');
header( 'Content-Type: text/html; charset=utf-8' );
session_start();
$db = opdClass::create(
array(
'dsn' => 'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['name'],
'user' => $config['db']['user'] ,
'password' => $config['db']['password'] ,
'cache' => 'temp/' ,
'debugConsole' => $config['db']['debug']
)
);
$db -> query( 'SET NAMES utf8' );
$mdb = new medoo( [
'database_type' => 'mysql',
'database_name' => $config['db']['name'],
'server' => $config['db']['host'],
'username' => $config['db']['user'],
'password' => $config['db']['password'],
'charset' => 'utf8'
] );
if ( \S::get( 'd4s-id' ) )
$mdb -> update( 'pro_rr_phrases', [ 'ds_ready' => 1 ], [ 'ds_id' => \S::get( 'd4s-id' ) ] );
// function _in_logit_POST( $id_message, $data ) {
// @file_put_contents(__DIR__."/postback_url_example.log", PHP_EOL.date("Y-m-d H:i:s").": ".$id_message.PHP_EOL."---------".PHP_EOL.print_r($data, true).PHP_EOL."---------", FILE_APPEND);
// }
// $post_data_in = file_get_contents( 'php://input' );
// if ( !empty( $post_data_in ) )
// {
// $post_arr = json_decode( $post_data_in, true );
// if ( ( !empty( $post_arr ) ) AND ( $post_arr["status"] == "ok" ) )
// {
// foreach( $post_arr["results"]["organic"] as $tasks_row )
// {
// $phrase_id = $mdb -> get( 'pro_rr_phrases', 'id', [ 'ds_id' => $tasks_row['task_id'] ] );
// if ( $mdb -> count( 'pro_rr_phrases_positions', [ 'AND' => [ 'phrase_id' => $phrase_id, 'date' => date( 'Y-m-d' ) ] ] ) )
// {
// $mdb -> update( 'pro_rr_phrases_positions', [
// 'position' => (int)$tasks_row['result_position'],
// ], [
// 'AND' => [
// 'phrase_id' => $phrase_id,
// 'date' => date( 'Y-m-d' )
// ]
// ] );
// }
// else
// {
// $mdb -> insert( 'pro_rr_phrases_positions', [
// 'phrase_id' => $phrase_id,
// 'position' => (int)$tasks_row['result_position'],
// 'url' => $tasks_row['result_url'],
// 'map' => 0,
// 'date' => date( 'Y-m-d' )
// ] );
// $last_id = $mdb -> get( 'phrase_positions_statistic', 'id', [ 'phrase_id' => $phrase_id, 'ORDER' => [ 'date' => 'DESC' ] ] );
// if ( $last_id )
// $mdb -> query( 'DELETE FROM phrase_positions_statistic WHERE phrase_id = ' . $phrase_id . ' AND id NOT IN ( ' . $last_id . ' )' );
// $mdb -> insert( 'phrase_positions_statistic', [
// 'phrase_id' => $phrase_id,
// 'position' => (int)$tasks_row['result_position'],
// 'date' => date( 'Y-m-d' )
// ] );
// }
// $mdb -> update( 'pro_rr_phrases', [ 'last_checked' => date( 'Y-m-d' ), 'filled_missing_positions' => 0, 'ds_id' => null ], [ 'id' => $phrase_id ] );
// }
// echo "ok";
// } else {
// echo "error";
// }
// } else {
// echo "empty POST";
// }

View File

@@ -0,0 +1,30 @@
<?php
global $xajax;
$xajax -> register( XAJAX_FUNCTION, 'deleteAnalysisPhrase' );
$xajax -> register( XAJAX_FUNCTION, 'setPrice' );
$xajax -> register( XAJAX_FUNCTION, 'deleteAnalysisSite' );
function deleteAnalysisSite( $id, $phrase_id, $category_id )
{
if ( \factory\Analysis::deleteAnalysisLink( $id ) )
\S::alert( 'Wybrany link został usunięty.' );
$objResponse = new xajaxResponse;
$objResponse -> script( '$( "#site_' . $id . '" ).remove();' );
return $objResponse;
}
function setPrice( $id, $price )
{
\factory\Analysis::setPrice( $id, $price );
}
function deleteAnalysisPhrase( $id, $category_id )
{
if ( \factory\Analysis::deletePhrase( $id ) )
\S::alert( 'Wybrana fraza została usunięta.' );
$objResponse = new xajaxResponse();
$objResponse -> script( 'document.location.href="./?rw=show_phrases&id=' . $category_id . '";' );
return $objResponse;
}

View File

@@ -0,0 +1,8 @@
<?php
global $xajax;
$xajax -> register( XAJAX_FUNCTION , 'markMessageAsReaded' );
function markMessageAsReaded( $id )
{
\factory\Messages::markMessageAsReaded( $id );
}

View File

@@ -0,0 +1,20 @@
<?php
global $xajax;
$xajax -> register( XAJAX_FUNCTION, 'changePhrasePosition' );
$xajax -> register( XAJAX_FUNCTION, 'refreshPhrase' );
function changePhrasePosition( $phrase_id, $date, $position )
{
global $mdb;
\factory\Ranker::changePhrasePosition( $phrase_id, $date, $position );
}
function refreshPhrase( $phrase_id )
{
global $mdb;
\factory\Ranker::refreshPhrase( $phrase_id );
$ajax = new \xajaxResponse;
$ajax -> script( '$( "#' . $phrase_id . '-' . date( 'Y-m-d' ) . ' span" ).html( "" );' );
return $ajax;
}

View File

@@ -0,0 +1,8 @@
<?php
global $xajax;
$xajax -> register( XAJAX_FUNCTION , 'saveSettings' );
function saveSettings( $param, $value )
{
\factory\Settings::saveSettings( $param, $value );
}

8
functions/xajax.php Normal file
View File

@@ -0,0 +1,8 @@
<?
$xajax = new xajax();
include 'functions/xajax-messages.php';
include 'functions/xajax-settings.php';
include 'functions/xajax-analysis.php';
include 'functions/xajax-ranker.php';
$xajax -> processRequest();
$xajax -> configure( 'javascript URI', 'resources/xajax/' );

BIN
google-rank.txt Normal file

Binary file not shown.

66
index.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
function __autoload_my_classes( $classname )
{
$q = explode( '\\' , $classname );
$c = array_pop( $q );
$f = 'autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
if ( $c == 'Savant3' )
{
require_once 'autoload/Savant3.php';
return true;
}
if ( file_exists( $f ) )
require_once( $f );
}
spl_autoload_register( '__autoload_my_classes' );
mb_internal_encoding( "UTF-8" );
define( 'OPD_DIR' , 'autoload/' );
require_once OPD_DIR . 'opd.class.php';
require_once 'config.php';
require_once 'libraries/medoo.php';
require_once 'libraries/grid/config.php';
require_once 'resources/xajax/xajax_core/xajax.inc.php';
date_default_timezone_set('Europe/Warsaw');
function sortByOption( $a, $b ) {
return strcmp( $a['date'], $b['date']);
}
session_start();
$db = opdClass::create(
array(
'dsn' => 'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['name'],
'user' => $config['db']['user'] ,
'password' => $config['db']['password'] ,
'cache' => 'temp/' ,
'debugConsole' => $config['db']['debug']
)
);
$db -> query( 'SET NAMES utf8' );
$mdb = new medoo( [
'database_type' => 'mysql',
'database_name' => $config['db']['name'],
'server' => $config['db']['host'],
'username' => $config['db']['user'],
'password' => $config['db']['password'],
'charset' => 'utf8'
] );
$user = \S::get_session( 'user' );
$cache = new \FileCache;
if ( !$settings = \S::get_session( 'settings' ) )
\S::set_session( 'settings', $settings = \factory\Settings::getSettings() );
include 'functions/xajax.php';
\controls\Page::checkUrlParams();
$user = \S::get_session( 'user' );
echo \view\Page::show();

153
json.php Normal file
View File

@@ -0,0 +1,153 @@
<?php
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
function __autoload_my_classes( $classname )
{
$q = explode( '\\' , $classname );
$c = array_pop( $q );
$f = 'autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
if ( $c == 'Savant3' )
{
require_once 'autoload/Savant3.php';
return true;
}
if ( file_exists( $f ) )
require_once( $f );
}
spl_autoload_register( '__autoload_my_classes' );
mb_internal_encoding( "UTF-8" );
define( 'OPD_DIR' , 'autoload/' );
require_once OPD_DIR . 'opd.class.php';
require_once 'config.php';
require_once 'libraries/medoo.php';
require_once 'libraries/grid/config.php';
require_once 'resources/xajax/xajax_core/xajax.inc.php';
date_default_timezone_set('Europe/Warsaw');
function sortByOption( $a, $b ) {
return strcmp( $a['date'], $b['date']);
}
session_start();
$db = opdClass::create(
array(
'dsn' => 'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['name'],
'user' => $config['db']['user'] ,
'password' => $config['db']['password'] ,
'cache' => 'temp/' ,
'debugConsole' => $config['db']['debug']
)
);
$db -> query( 'SET NAMES utf8' );
$mdb = new medoo( [
'database_type' => 'mysql',
'database_name' => $config['db']['name'],
'server' => $config['db']['host'],
'username' => $config['db']['user'],
'password' => $config['db']['password'],
'charset' => 'utf8'
] );
$cache = new \FileCache;
if ( \S::get( 'action' ) == 'site_tf' )
{
$output["name"] = "Trust Flow";
$results = $mdb -> select( 'pro_rr_sites_majestic', [ 'tf', 'date' ], [ 'site_id' => \S::get( 'site_id' ), 'ORDER' => [ 'date' => 'ASC' ] ] );
if ( is_array( $results ) ) foreach ( $results as $row )
if ( $row['tf'] !== null )
$data[] = [ gmmktime(0, 0, 0, date( 'n', strtotime( $row['date'] ) ), date( 'j', strtotime( $row['date'] ) ), date( 'Y', strtotime( $row['date'] ) ) ) * 1000, $row['tf'] ];
$output['data'] = $data;
echo "[" . json_encode( $output, JSON_NUMERIC_CHECK ) . "]";
exit;
}
if ( \S::get( 'action' ) == 'site_cf' )
{
$output["name"] = "Citation Flow";
$results = $mdb -> select( 'pro_rr_sites_majestic', [ 'cf', 'date' ], [ 'site_id' => \S::get( 'site_id' ), 'ORDER' => [ 'date' => 'ASC' ] ] );
if ( is_array( $results ) ) foreach ( $results as $row )
$data[] = [ gmmktime(0, 0, 0, date( 'n', strtotime( $row['date'] ) ), date( 'j', strtotime( $row['date'] ) ), date( 'Y', strtotime( $row['date'] ) ) ) * 1000, $row['cf'] ];
$output['data'] = $data;
echo "[" . json_encode( $output, JSON_NUMERIC_CHECK ) . "]";
exit;
}
if ( \S::get( 'action' ) == 'site_rd' )
{
$output["name"] = "Referring Domains";
$results = $mdb -> select( 'pro_rr_sites_majestic', [ 'rd', 'date' ], [ 'site_id' => \S::get( 'site_id' ), 'ORDER' => [ 'date' => 'ASC' ] ] );
if ( is_array( $results ) ) foreach ( $results as $row )
$data[] = [ gmmktime(0, 0, 0, date( 'n', strtotime( $row['date'] ) ), date( 'j', strtotime( $row['date'] ) ), date( 'Y', strtotime( $row['date'] ) ) ) * 1000, $row['rd'] ];
$output['data'] = $data;
echo "[" . json_encode( $output, JSON_NUMERIC_CHECK ) . "]";
exit;
}
if ( \S::get( 'action' ) == 'site_feb' )
{
$output["name"] = "Majestic Backlinks";
$results = $mdb -> select( 'pro_rr_sites_majestic', [ 'feb', 'date' ], [ 'site_id' => \S::get( 'site_id' ), 'ORDER' => [ 'date' => 'ASC' ] ] );
if ( is_array( $results ) ) foreach ( $results as $row )
$data[] = [ gmmktime(0, 0, 0, date( 'n', strtotime( $row['date'] ) ), date( 'j', strtotime( $row['date'] ) ), date( 'Y', strtotime( $row['date'] ) ) ) * 1000, $row['feb'] ];
$output['data'] = $data;
echo "[" . json_encode( $output, JSON_NUMERIC_CHECK ) . "]";
exit;
}
if ( \S::get( 'action' ) == 'site_top3' )
{
$output["name"] = "Semstorm Top3";
$results = $mdb -> select( 'pro_rr_sites_semstorm', [ 'top3', 'date' ], [ 'site_id' => \S::get( 'site_id' ), 'ORDER' => [ 'date' => 'ASC' ] ] );
if ( is_array( $results ) ) foreach ( $results as $row )
$data[] = [ gmmktime(0, 0, 0, date( 'n', strtotime( $row['date'] ) ), date( 'j', strtotime( $row['date'] ) ), date( 'Y', strtotime( $row['date'] ) ) ) * 1000, $row['top3'] ];
$output['data'] = $data;
echo "[" . json_encode( $output, JSON_NUMERIC_CHECK ) . "]";
exit;
}
if ( \S::get( 'action' ) == 'site_top10' )
{
$output["name"] = "Semstorm Top10";
$results = $mdb -> select( 'pro_rr_sites_semstorm', [ 'top10', 'date' ], [ 'site_id' => \S::get( 'site_id' ), 'ORDER' => [ 'date' => 'ASC' ] ] );
if ( is_array( $results ) ) foreach ( $results as $row )
$data[] = [ gmmktime(0, 0, 0, date( 'n', strtotime( $row['date'] ) ), date( 'j', strtotime( $row['date'] ) ), date( 'Y', strtotime( $row['date'] ) ) ) * 1000, $row['top10'] ];
$output['data'] = $data;
echo "[" . json_encode( $output, JSON_NUMERIC_CHECK ) . "]";
exit;
}
if ( \S::get( 'action' ) == 'site_top50' )
{
$output["name"] = "Semstorm Top50";
$results = $mdb -> select( 'pro_rr_sites_semstorm', [ 'top50', 'date' ], [ 'site_id' => \S::get( 'site_id' ), 'ORDER' => [ 'date' => 'ASC' ] ] );
if ( is_array( $results ) ) foreach ( $results as $row )
$data[] = [ gmmktime(0, 0, 0, date( 'n', strtotime( $row['date'] ) ), date( 'j', strtotime( $row['date'] ) ), date( 'Y', strtotime( $row['date'] ) ) ) * 1000, $row['top50'] ];
$output['data'] = $data;
echo "[" . json_encode( $output, JSON_NUMERIC_CHECK ) . "]";
exit;
}

98305
latest.csv Normal file

File diff suppressed because it is too large Load Diff

BIN
layout/logo-project-pro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
layout/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,202 @@
$breakpoints: (
xs: 576px,
sm: 768px,
md: 992px,
lg: 1200px
);
@mixin respond-above($breakpoint) {
@if map-has-key($breakpoints, $breakpoint) {
$breakpoint-value: map-get($breakpoints, $breakpoint);
@media (min-width: $breakpoint-value) {
@content;
}
} @else {
@warn 'Invalid breakpoint: #{$breakpoint}.';
}
}
@mixin respond-below($breakpoint) {
@if map-has-key($breakpoints, $breakpoint) {
$breakpoint-value: map-get($breakpoints, $breakpoint);
@media (max-width: ($breakpoint-value - 1)) {
@content;
}
} @else {
@warn 'Invalid breakpoint: #{$breakpoint}.';
}
}
@mixin respond-between($lower, $upper) {
@if map-has-key($breakpoints, $lower) and map-has-key($breakpoints, $upper) {
$lower-breakpoint: map-get($breakpoints, $lower);
$upper-breakpoint: map-get($breakpoints, $upper);
@media (min-width: $lower-breakpoint) and (max-width: ($upper-breakpoint - 1)) {
@content;
}
} @else {
@if (map-has-key($breakpoints, $lower) == false) {
@warn 'Your lower breakpoint was invalid: #{$lower}.';
}
@if (map-has-key($breakpoints, $upper) == false) {
@warn 'Your upper breakpoint was invalid: #{$upper}.';
}
}
}
@mixin border-radius($px: 0) {
-webkit-border-radius: $px;
-moz-border-radius: $px;
border-radius: $px;
}
@mixin box-shadow($value) {
-webkit-box-shadow: $value;
-moz-box-shadow: $value;
box-shadow: $value;
}
@mixin transition($element: all, $time: .5s, $option: ease) {
-webkit-transition: $element $time $option !important;
transition: $element $time $option !important;
}
@mixin opacity($value) {
$IEValue: $value*100;
opacity: $value;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity="+$IEValue+")";
filter: alpha(opacity=$IEValue);
}@mixin flexbox() {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
// The 'flex' shorthand
// - applies to: flex items
// <positive-number>, initial, auto, or none
@mixin flex($values) {
-webkit-box-flex: $values;
-moz-box-flex: $values;
-webkit-flex: $values;
-ms-flex: $values;
flex: $values;
}
// Flex Flow Direction
// - applies to: flex containers
// row | row-reverse | column | column-reverse
@mixin flex-direction($direction) {
-webkit-flex-direction: $direction;
-moz-flex-direction: $direction;
-ms-flex-direction: $direction;
flex-direction: $direction;
}
// Flex Line Wrapping
// - applies to: flex containers
// nowrap | wrap | wrap-reverse
@mixin flex-wrap($wrap) {
-webkit-flex-wrap: $wrap;
-moz-flex-wrap: $wrap;
-ms-flex-wrap: $wrap;
flex-wrap: $wrap;
}
// Flex Direction and Wrap
// - applies to: flex containers
// <flex-direction> || <flex-wrap>
@mixin flex-flow($flow) {
-webkit-flex-flow: $flow;
-moz-flex-flow: $flow;
-ms-flex-flow: $flow;
flex-flow: $flow;
}
// Display Order
// - applies to: flex items
// <integer>
@mixin order($val) {
-webkit-box-ordinal-group: $val;
-moz-box-ordinal-group: $val;
-ms-flex-order: $val;
-webkit-order: $val;
order: $val;
}
// Flex grow factor
// - applies to: flex items
// <number>
@mixin flex-grow($grow) {
-webkit-flex-grow: $grow;
-moz-flex-grow: $grow;
-ms-flex-grow: $grow;
flex-grow: $grow;
}
// Flex shrink
// - applies to: flex item shrink factor
// <number>
@mixin flex-shrink($shrink) {
-webkit-flex-shrink: $shrink;
-moz-flex-shrink: $shrink;
-ms-flex-shrink: $shrink;
flex-shrink: $shrink;
}
// Flex basis
// - the initial main size of the flex item
// - applies to: flex itemsnitial main size of the flex item
// <width>
@mixin flex-basis($width) {
-webkit-flex-basis: $width;
-moz-flex-basis: $width;
-ms-flex-basis: $width;
flex-basis: $width;
}
// Axis Alignment
// - applies to: flex containers
// flex-start | flex-end | center | space-between | space-around
@mixin justify-content($justify) {
-webkit-justify-content: $justify;
-moz-justify-content: $justify;
-ms-justify-content: $justify;
justify-content: $justify;
-ms-flex-pack: $justify;
}
// Packing Flex Lines
// - applies to: multi-line flex containers
// flex-start | flex-end | center | space-between | space-around | stretch
@mixin align-content($align) {
-webkit-align-content: $align;
-moz-align-content: $align;
-ms-align-content: $align;
align-content: $align;
}
// Cross-axis Alignment
// - applies to: flex containers
// flex-start | flex-end | center | baseline | stretch
@mixin align-items($align) {
-webkit-align-items: $align;
-moz-align-items: $align;
-ms-align-items: $align;
align-items: $align;
}
// Cross-axis Alignment
// - applies to: flex items
// auto | flex-start | flex-end | center | baseline | stretch
@mixin align-self($align) {
-webkit-align-self: $align;
-moz-align-self: $align;
-ms-align-self: $align;
align-self: $align;
}
@mixin firefox {
@at-root {
@-moz-document url-prefix() {
& {
@content;
}
}
}
}

View File

@@ -0,0 +1,7 @@
.clearfix {
&:after {
content: "";
display: table;
clear: both;
}
}

View File

@@ -0,0 +1,962 @@
// out: ../style-css/custom.css, compress: true, sourceMap: true
@import "_mixins";
@import "_stuff";
.col-centred {
float: none !important;
margin: 0 auto;
}
body {
color: #2b2b2b;
}
body.external-page #content .admin-form {
max-width: 450px;
}
.navbar-branding {
display: block !important;
width: 95px !important;
}
.panel-controls>a {
color: #999 !important;
}
.panel-group .panel-heading,
.panel-group .panel-heading a {
width: auto;
min-width: 150px;
}
.table-condensed {
font-size: 12px;
}
.bn {
border: 0px !important;
}
.pointer {
cursor: pointer !important;
}
.ui-autocomplete {
max-height: 200px;
overflow-y: scroll;
overflow-x: hidden;
}
.ui-menu {
background: #FFF;
}
.ui-menu-item {
padding: 3px 5px;
border-bottom: 1px dotted #cbcbcb;
}
.ui-menu .ui-menu-item a {
color: #777777;
font-size: 11px;
font-family: verdana;
}
.ui-menu-item .ui-state-hover {
background: #5bb75b;
;
color: #FFF !important;
margin: 0 !important;
cursor: pointer;
}
.inline {
display: inline;
}
#g-row-limit {
width: auto;
display: inline-block;
height: 30px;
line-height: 30px;
padding: 4px 12px;
}
.sidebar-menu>li>a>span:nth-child(2) {
padding: 0;
}
#overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 400;
background: rgba(0, 0, 0, 0.2);
display: none;
cursor: pointer;
}
#ajax-container {
position: fixed;
padding: 20px 20px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 800px;
width: 800px;
overflow-y: auto;
overflow-x: hidden;
background: #FFF;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
z-index: 500;
display: none;
}
#cron-container {
height: 404px;
overflow-x: hidden;
overflow-y: auto;
}
#cron-container .msg {
border: 1px solid #ddd;
padding: 5px 10px;
margin: 0;
border-top: 0;
}
#cron-container .msg:first-child {
border-top: 1px solid #ddd;
}
#cron-container .msg:nth-child(odd) {
background: #f5f6f8;
}
#cron-container .msg a {
font-weight: 600;
}
.callback {
font-size: 17px;
background: #27ae60;
padding: 10px;
color: #ecf0f1;
margin-bottom: 10px;
-webkit-transition: background 0.5s ease-out;
transition: background 0.5s ease-out;
}
.ended {
background: #c0392b;
}
#images-list {
padding: 0;
margin: 0 0 20px;
}
#images-list li {
background: #fff none repeat scroll 0 0;
border: 5px solid #fff;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
display: block;
float: left;
height: 100px;
margin: 5px;
text-align: center;
vertical-align: middle;
width: 100px;
}
.article-image-edit {
background: rgba(255, 255, 255, 0.8);
height: 90px;
width: 100%;
box-sizing: border-box;
display: none;
}
.article-image-edit i {
font-size: 30px;
position: relative;
top: 30px;
cursor: pointer;
}
#images-list li:hover .article-image-edit,
#images-list li.pending .article-image-edit {
display: block;
}
#images-uploader,
#files-uploader {
clear: both;
}
#main {
background: #F2F2F2;
}
.page-options {
float: left;
}
.page-options * {
-webkit-user-select: none;
/* Chrome/Safari */
-moz-user-select: none;
/* Firefox */
-ms-user-select: none;
/* IE10+ */
/* Rules below not implemented in browsers yet */
-o-user-select: none;
user-select: none;
}
.pos_1 span {
background: #6A8DA7 !important;
color: #FFF !important;
}
.pos_2 span {
background: #56BC76 !important;
color: #FFF !important;
}
.pos_4 span {
background: #cb60b3 !important;
color: #FFF !important;
}
.pos_7 span {
background: #E5603B !important;
color: #FFF !important;
}
.pos_11 span {
background: #666666 !important;
color: #FFF !important;
}
.to-check span {
background: #3bafda !important;
color: #FFF !important;
}
.table-positions td {
min-width: 40px;
padding: 0 !important;
}
.phrase_url {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 10px;
display: none;
user-select: none;
}
.p0 {
padding: 0 !important;
}
.text-dark {
color: #666666 !important;
}
.ranker-select {
width: 100%;
max-width: 150px;
display: inline-block;
height: 30px;
line-height: 30px;
padding: 1px 12px;
margin-top: 5px;
position: relative;
top: 2px;
}
.a-icon:hover,
.a-icon:focus {
text-decoration: none;
}
.panel-heading.small {
height: 30px;
line-height: 26px;
font-weight: 400;
font-size: 12px;
}
.fr {
float: right;
}
form.labeled .form-group {
margin-bottom: 0;
}
.text-danger {
color: #e9573f !important;
}
.download-info,
.new-swl {
color: #FFF;
width: 30px;
position: relative;
font-size: 11px;
cursor: pointer;
}
.swl-info,
.new-swl-info {
position: absolute;
top: 0px;
left: 29px;
border: 5px solid #3bafda;
width: 600px;
height: 260px;
background: #f9f9f9;
z-index: 500;
padding: 10px;
color: #000;
display: none;
cursor: default;
}
.new-swl-info {
height: 130px;
}
.progress-bar {
font-size: 13px;
}
.hidden {
display: none;
}
.pull-right-not-xs,
.pull-right-not-sm,
.pull-right-not-md,
.pull-right-not-lg {
float: right !important;
}
.pull-left-not-xs,
.pull-left-not-sm,
.pull-left-not-md,
.pull-left-not-lg {
float: left !important;
}
#brand .col-sm-4:nth-child(3n+1) {
clear: both;
}
.lead {
margin-bottom: 0 !important;
}
@media (max-width: 767px) {
.pull-right-not-xs,
.pull-left-not-xs {
float: none !important;
}
.pull-right-xs {
float: right !important;
}
.pull-left-xs {
float: left !important;
}
.col-centred-xs {
float: none !important;
margin: 0 auto;
}
.text-centred-xs {
text-align: center !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.pull-right-not-sm,
.pull-left-not-sm {
float: none !important;
}
.pull-right-sm {
float: right !important;
}
.pull-left-sm {
float: left !important;
}
.col-centred-sm {
float: none !important;
margin: 0 auto;
}
.text-centred-sm {
text-align: center !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.pull-right-not-md,
.pull-left-not-md {
float: none !important;
}
.pull-right-md {
float: right !important;
}
.pull-left-md {
float: left !important;
}
.col-centred-md {
float: none !important;
margin: 0 auto;
}
.text-centred-sm {
text-align: center !important;
}
}
@media (min-width: 1200px) {
.pull-right-not-lg,
.pull-left-not-lg {
float: none !important;
}
.pull-right-lg {
float: right !important;
}
.pull-left-lg {
float: left !important;
}
.col-centred-lg {
float: none !important;
margin: 0 auto;
}
.text-centred-lg {
text-align: center !important;
}
}
@media (min-width:1140px) {
.auto-clear .col-lg-1:nth-child(12n+1) {
clear: left;
}
.auto-clear .col-lg-2:nth-child(6n+1) {
clear: left;
}
.auto-clear .col-lg-3:nth-child(4n+1) {
clear: left;
}
.auto-clear .col-lg-4:nth-child(3n+1) {
clear: left;
}
.auto-clear .col-lg-6:nth-child(odd) {
clear: left;
}
}
@media (min-width:992px) and (max-width:1139px) {
.auto-clear .col-md-1:nth-child(12n+1) {
clear: left;
}
.auto-clear .col-md-2:nth-child(6n+1) {
clear: left;
}
.auto-clear .col-md-3:nth-child(4n+1) {
clear: left;
}
.auto-clear .col-md-4:nth-child(3n+1) {
clear: left;
}
.auto-clear .col-md-6:nth-child(odd) {
clear: left;
}
}
@media (min-width:768px) and (max-width:991px) {
.auto-clear .col-sm-1:nth-child(12n+1) {
clear: left;
}
.auto-clear .col-sm-2:nth-child(6n+1) {
clear: left;
}
.auto-clear .col-sm-3:nth-child(4n+1) {
clear: left;
}
.auto-clear .col-sm-4:nth-child(3n+1) {
clear: left;
}
.auto-clear .col-sm-6:nth-child(odd) {
clear: left;
}
}
@media (max-width:767px) {
.auto-clear .col-xs-1:nth-child(12n+1) {
clear: left;
}
.auto-clear .col-xs-2:nth-child(6n+1) {
clear: left;
}
.auto-clear .col-xs-3:nth-child(4n+1) {
clear: left;
}
.auto-clear .col-xs-4:nth-child(3n+1) {
clear: left;
}
.auto-clear .col-xs-6:nth-child(odd) {
clear: left;
}
}
.range_inputs button {
width: 100%;
}
.select-form .btn-group,
.select-form button {
width: 100%;
}
.event-exists {
background: #e9573f !important;
color: #FFF;
cursor: pointer;
}
#comment-info {
position: fixed;
left: 50%;
top: 50%;
width: 600px;
height: 325px;
background: #f9f9f9;
z-index: 13500;
padding: 10px;
color: #000;
display: none;
cursor: default;
transform: translate(-50%, -50%);
}
#comment-info textarea {
height: 250px;
}
#comment-info .btn {
border: 0 !important;
}
.nav>li>a {
font-size: 12px;
}
.calendar {
width: 100%;
}
.calendar h3 {
text-align: right;
}
.calendar-day-head {
background: #eeeeee;
border: 1px solid #dddddd;
text-align: center;
width: 14.28571428571429%;
padding: 5px;
text-transform: capitalize;
font-weight: 400;
}
.calendar-day,
.calendar-day-np {
border: 1px solid #FFF;
text-align: center;
line-height: 80px;
background: #30363e;
color: #FFF;
position: relative;
}
.calendar .today {
background: #DDD;
color: #000;
}
.calendar .event {
background: #3078d7;
}
.calendar-day p {
position: absolute;
top: 5px;
right: 5px;
line-height: 20px;
width: 20px;
height: 20px;
background: #FFF;
border-radius: 10px;
color: #30363e;
font-weight: 900;
font-size: 12px;
}
.fc-event {
border-radius: 0;
}
.event-details {
cursor: default;
display: none;
min-height: 50px;
}
.fc-event-danger {
border: 1px solid #e9573f;
border-left: 4px solid #e9573f;
}
#recursive-details,
#reminder-interval {
display: none;
}
.fc-event-desc {
display: block;
}
.fc-event-done {
opacity: .4;
}
.text-bold {
font-weight: bold !important;
}
#table-phrases {
border-collapse: separate;
border-spacing: 0;
}
#table-phrases td {
border-top: 0;
border-left: 0;
border-right: 0;
}
.disabled {
opacity: .25;
pointer-events: none;
}
.site-buttons .btn {
margin-left: 1px !important;
}
td.error {
background: #cc0000 !important;
color: #FFF !important;
}
.panel-heading .ranker-select {
margin-top: 0;
}
#client-last-logged .panel-body p:last-child {
margin-bottom: 0;
}
#table-phrases .phrase {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
max-width: calc(100% - 110px);
float: right;
}
.bold {
font-weight: 600;
}
#year_global {
width: 80px;
}
#month_global {
width: 100px;
}
.positions::after {
display: block;
content: '';
clear: both;
}
.positions .left-column {
width: 350px;
float: left;
}
.positions .left-column .phrase-info {
background: #FFF;
font-size: 12px;
padding: 5px 10px 5px 20px;
border-bottom: 1px solid #e5e5e5;
height: 45px;
position: relative;
}
.positions .left-column .phrase-info .swl-stats {
height: 45px;
width: 30px;
text-align: center;
position: absolute;
top: 0;
left: -15px;
color: #FFF;
line-height: 45px;
border-bottom: 1px solid #FFF;
}
.positions .left-column .phrase-info .phrase-options {
position: absolute;
left: 100%;
top: 0;
z-index: 10;
background: #607596;
height: 45px;
line-height: 45px;
padding: 0 10px;
color: #FFF;
border-bottom: 1px solid #FFF;
width: 0;
overflow: hidden;
transition: width 0.5s ease;
i.fa-map-marker {
position: relative;
left: -4px;
opacity: .6;
top: 2px;
}
}
.positions .left-column .phrase-info:hover .phrase-options {
width: 185px;
}
.positions .left-column .phrase-info .phrase-options a {
color: #FFF;
}
.positions .left-column .row:first-child .phrase-info {
height: 38px;
}
.positions .left-column .phrase-info .phrase,
.positions .left-column .phrase-info .phrase-url {
display: block;
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.positions .left-column .phrase-info .phrase {
color: #292929;
}
.positions .right-column {
width: calc(100% - 350px);
float: left;
}
.positions .table-responsive {
padding-left: 20px;
}
.positions table {
table-layout: fixed;
}
.positions table td,
.positions table th {
height: 45px;
width: 42px !important;
line-height: 35px !important;
padding: 0 !important;
}
.positions table th {
background: #FFF;
height: 34px;
}
.positions {
table {
width: auto;
td {
padding: 1px;
position: relative;
line-height: 45px !important;
span {
display: block;
position: absolute;
top: 0;
left: 1px;
width: 100%;
height: 100%;
@include firefox {
top: 1px;
}
}
}
}
}
.positions table .position {
position: relative;
}
.positions table .position input {
width: 100%;
height: 100%;
text-align: center;
border: 1px solid #e5e5e5;
display: none;
outline: none;
color: #000;
position: absolute;
top: 1px;
left: 1px;
}
#swl-content {
width: 100% !important;
height: 90% !important;
left: 50% !important;
transform: translate(calc(-50% + 0.5px), calc(-50% + 0.5px));
position: fixed !important;
top: 50% !important;
display: none;
}
#swl-content .content {
position: absolute;
width: 100%;
height: 100%;
overflow: auto;
}
#swl-content iframe {
width: 100%;
height: 1000px;
}
.spin {
-webkit-animation-name: spin;
-webkit-animation-duration: 2000ms;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
-moz-animation-name: spin;
-moz-animation-duration: 2000ms;
-moz-animation-iteration-count: infinite;
-moz-animation-timing-function: linear;
-ms-animation-name: spin;
-ms-animation-duration: 2000ms;
-ms-animation-iteration-count: infinite;
-ms-animation-timing-function: linear;
animation-name: spin;
animation-duration: 2000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@-ms-keyframes spin {
from {
-ms-transform: rotate(0deg);
}
to {
-ms-transform: rotate(360deg);
}
}
@-moz-keyframes spin {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
}
}
@-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

BIN
layout/user-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

18
libraries/countdown/jquery-wrapper.js vendored Normal file
View File

@@ -0,0 +1,18 @@
var Countdown = require('./countdown.js');
var NAME = 'countdown';
var DATA_ATTR = 'date';
jQuery.fn.countdown = function(options) {
return $.each(this, function(i, el) {
var $el = $(el);
if (!$el.data(NAME)) {
// allow setting the date via the data-date attribute
if ($el.data(DATA_ATTR)) {
options.date = $el.data(DATA_ATTR);
}
$el.data(NAME, new Countdown(el, options));
}
});
};
module.exports = Countdown;

View File

@@ -0,0 +1,215 @@
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.Countdown=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var defaultOptions = {
date: "June 7, 2087 15:03:25",
refresh: 1000,
offset: 0,
onEnd: function() {
return;
},
render: function (date) {
this.el.innerHTML = date.years + " years, " +
date.days + " days, " +
this.leadingZeros(date.hours) + " hours, " +
this.leadingZeros(date.min) + " min and " +
this.leadingZeros(date.sec) + " sec";
}
};
/**
* Countdown constructor
* @param {HTMLElement} el DOM node of the countdown
* @param {Object} options (optional) Options for the plugin
*/
var Countdown = function(el, options) {
/**
* Reference to the DOM element
* @type {HTMLElement}
*/
this.el = el;
/**
* Options of the countdown plugin
* @type {Object}
*/
this.options = {};
/**
* Interval reference or false if counter is stopped
* @type {Mixed}
*/
this.interval = false;
// merge default options and options into this.options
for (var i in defaultOptions) {
if (defaultOptions.hasOwnProperty(i)) {
this.options[i] = typeof options[i] !== 'undefined' ? options[i] : defaultOptions[i];
if (i === 'date' && typeof this.options.date !== 'object') {
this.options.date = new Date(this.options.date);
}
// bind context for functions
if (typeof this.options[i] === 'function') {
this.options[i] = this.options[i].bind(this);
}
}
}
/**
* Get the difference between now and the end date
* @return {Object} Object with the diff information (years, days, hours, min, sec, millisec)
*/
this.getDiffDate = function() {
var diff = (this.options.date.getTime() - Date.now() + this.options.offset) / 1000;
var dateData = {
years: 0,
days: 0,
hours: 0,
min: 0,
sec: 0,
millisec: 0
};
if (diff <= 0) {
if (this.interval) {
this.stop();
this.options.onEnd();
}
return dateData;
}
if (diff >= (365.25 * 86400)) {
dateData.years = Math.floor(diff / (365.25 * 86400));
diff -= dateData.years * 365.25 * 86400;
}
if (diff >= 86400) {
dateData.days = Math.floor(diff / 86400);
diff -= dateData.days * 86400;
}
if (diff >= 3600) {
dateData.hours = Math.floor(diff / 3600);
diff -= dateData.hours * 3600;
}
if (diff >= 60) {
dateData.min = Math.floor(diff / 60);
diff -= dateData.min * 60;
}
dateData.sec = Math.round(diff);
dateData.millisec = diff % 1 * 1000;
return dateData;
}.bind(this);
/**
* Add leading zeros to a number
* @param {Number} num Input number
* @param {Number} length Length of the desired output
* @return {String} String of the desired length with leading zeros
*/
this.leadingZeros = function(num, length) {
length = length || 2;
num = String(num);
if (num.length > length) {
return num;
}
return (Array(length + 1).join('0') + num).substr(-length);
};
/**
* Update the end date of the countdown
* @param {Mixed} newDate Date object or a String/Number that can be passed to the Date constructor
* @return {Countdown} Countdown instance
*/
this.update = function(newDate) {
if (typeof newDate !== 'object') {
newDate = new Date(newDate);
}
this.options.date = newDate;
this.render();
return this;
}.bind(this);
/**
* Stop the countdown refresh / rerender
* @return {Countdown} Countdown instance
*/
this.stop = function() {
if (this.interval) {
clearInterval(this.interval);
this.interval = false;
}
return this;
}.bind(this);
/**
* Render the countdown
* @return {Countdown} Countdown instance
*/
this.render = function() {
this.options.render(this.getDiffDate());
return this;
}.bind(this);
/**
* Start the countdown
* @return {Countdown} Countdown instance
*/
this.start = function() {
// don't start if the countdown is already started
if (this.interval) { return; }
this.render();
if (this.options.refresh) {
this.interval = setInterval(this.render, this.options.refresh);
}
return this;
}.bind(this);
/**
* Update the offset
* @param {Number} offset New offset in ms
* @return {Countdown} Countdown instance
*/
this.updateOffset = function(offset) {
this.options.offset = offset;
return this;
}.bind(this);
// initial start of the countdown or initial render
this.start();
};
module.exports = Countdown;
},{}],2:[function(require,module,exports){
var Countdown = require('./countdown.js');
var NAME = 'countdown';
var DATA_ATTR = 'date';
jQuery.fn.countdown = function(options) {
return $.each(this, function(i, el) {
var $el = $(el);
if (!$el.data(NAME)) {
// allow setting the date via the data-date attribute
if ($el.data(DATA_ATTR)) {
options.date = $el.data(DATA_ATTR);
}
$el.data(NAME, new Countdown(el, options));
}
});
};
module.exports = Countdown;
},{"./countdown.js":1}]},{},[2])(2)
});

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,168 @@
/* This file creates the AdminForm "theme-alert" skin.
* The success color is applied to every form element and widget
* via the styles generated by the admin-skins.less mixin
*/
.admin-form .panel-alert > .panel-heading {
border-top-color: #ac92ec;
}
.admin-form .panel-alert > .panel-heading:before {
background-color: #967adc;
}
.admin-form .panel-alert.heading-border:before,
.admin-form .panel-alert .heading-border:before {
background-color: #967adc;
}
.admin-form .bg-alert {
background-color: #967adc;
}
.admin-form .bg-alert.light {
background-color: #ac92ec;
}
.admin-form .bg-alert.lighter {
background-color: #c0b0ea;
}
.admin-form .bg-alert.dark {
background-color: #815fd5;
}
.admin-form .bg-alert.darker {
background-color: #6c44ce;
}
.admin-form .option-alert input:hover + .checkbox,
.admin-form .option-alert input:hover + .radio {
border-color: #ac92ec;
}
.admin-form .option-alert input:checked + .checkbox,
.admin-form .option-alert input:focus + .checkbox,
.admin-form .option-alert input:checked + .radio,
.admin-form .option-alert input:focus + .radio {
border-color: #967adc;
}
.admin-form .option-alert input:checked + .radio:before,
.admin-form .option-alert input:focus + .radio:before {
background: #967adc;
}
.admin-form .option-alert input:checked + .checkbox:before,
.admin-form .option-alert input:focus + .checkbox:before {
border-color: #967adc;
}
.admin-form .switch-alert > input:checked + label {
background: #967adc;
border-color: #967adc;
}
.admin-form .switch-alert > input:checked + label:after {
color: #967adc;
}
.admin-form .switch-alert > input:checked:focus + label {
background: #815fd5;
border-color: #815fd5;
}
.admin-form .btn-alert {
background-color: #967adc;
}
.admin-form .btn-alert:hover,
.admin-form .btn-alert:focus {
background-color: #ac92ec;
border-color: #ac92ec;
}
.admin-form .btn-alert:active {
background-color: #815fd5;
}
.admin-form .btn-alert,
.admin-form .btn-alert:hover,
.admin-form .btn-alert:focus,
.admin-form .btn-alert:active {
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.08);
}
.admin-form .slider-wrapper.slider-alert .ui-slider .ui-slider-range {
background-color: #967adc;
}
.admin-form .slider-wrapper.slider-alert .ui-slider .ui-slider-handle {
border-color: #967adc;
}
.admin-form .slider-wrapper.slider-alert .ui-slider .ui-slider-handle:before {
background-color: #967adc;
}
.admin-form.theme-alert .section-divider span {
color: #967adc;
}
.admin-form.theme-alert .tagline span {
color: #967adc;
}
.admin-form.theme-alert .theme-link {
color: #967adc;
}
.admin-form.theme-alert .gui-input:hover,
.admin-form.theme-alert .gui-textarea:hover,
.admin-form.theme-alert .select > select:hover,
.admin-form.theme-alert .select-multiple select:hover,
.admin-form.theme-alert .gui-input:hover ~ .input-footer,
.admin-form.theme-alert .file .gui-file:hover + .gui-input,
.admin-form.theme-alert .gui-textarea:hover ~ .input-footer {
border-color: #ac92ec;
}
.admin-form.theme-alert .gui-input:focus,
.admin-form.theme-alert .gui-textarea:focus,
.admin-form.theme-alert .select > select:focus,
.admin-form.theme-alert .select-multiple select:focus {
border-color: #ac92ec;
color: #3C3C3C;
}
.admin-form.theme-alert .gui-textarea:focus {
height: 120px;
}
.admin-form.theme-alert .select > select:focus {
z-index: 10;
z-index: 20\9;
}
.admin-form.theme-alert .gui-input:focus ~ .field-icon i,
.admin-form.theme-alert .gui-textarea:focus ~ .field-icon i {
color: #967adc;
}
.admin-form.theme-alert .select-multiple select:focus,
.admin-form.theme-alert .gui-input:focus ~ .input-footer,
.admin-form.theme-alert .gui-textarea:focus ~ .input-footer,
.admin-form.theme-alert .file .gui-file:focus + .gui-input {
border-color: #ac92ec;
}
.admin-form.theme-alert .select > select:focus + .arrow {
color: #967adc;
}
.admin-form.theme-alert .rating:hover .rating-star:hover,
.admin-form.theme-alert .rating:hover .rating-star:hover ~ .rating-star,
.admin-form.theme-alert .rating-input:checked ~ .rating-star {
color: #967adc;
}
.admin-form.theme-alert .rating-star,
.admin-form.theme-alert .rating:hover .rating-star {
color: #A2A6A8;
}
.admin-form.theme-alert .ui-datepicker .ui-datepicker-prev,
.admin-form.theme-alert .ui-datepicker .ui-datepicker-next,
.admin-form.theme-alert .ui-datepicker .ui-datepicker-title {
color: #967adc;
}
.admin-form.theme-alert .ui-datepicker-today a,
.admin-form.theme-alert .ui-datepicker-today a:hover,
.admin-form.theme-alert .ui-datepicker .ui-state-highlight {
background: #d6cbf1 !important;
}
.admin-form.theme-alert .ui-datepicker .ui-state-active {
background: #967adc !important;
}
.admin-form.theme-alert .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-active {
background: #FFF !important;
}
.admin-form.theme-alert .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle {
border-color: #967adc;
}
.admin-form.theme-alert .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle:before {
background-color: #967adc;
}
.admin-form.theme-alert .wizard .steps li a,
.admin-form.theme-alert .wizard .actions li a {
background-color: #967adc;
}
.admin-form.theme-alert .wizard .steps li.current a {
background-color: #815fd5;
}

View File

@@ -0,0 +1,168 @@
/* This file creates the AdminForm "theme-danger" skin.
* The success color is applied to every form element and widget
* via the styles generated by the admin-skins.less mixin
*/
.admin-form .panel-danger > .panel-heading {
border-top-color: #fc6e51;
}
.admin-form .panel-danger > .panel-heading:before {
background-color: #e9573f;
}
.admin-form .panel-danger.heading-border:before,
.admin-form .panel-danger .heading-border:before {
background-color: #e9573f;
}
.admin-form .bg-danger {
background-color: #e9573f;
}
.admin-form .bg-danger.light {
background-color: #fc6e51;
}
.admin-form .bg-danger.lighter {
background-color: #f08c7c;
}
.admin-form .bg-danger.dark {
background-color: #e63c21;
}
.admin-form .bg-danger.darker {
background-color: #cd3117;
}
.admin-form .option-danger input:hover + .checkbox,
.admin-form .option-danger input:hover + .radio {
border-color: #fc6e51;
}
.admin-form .option-danger input:checked + .checkbox,
.admin-form .option-danger input:focus + .checkbox,
.admin-form .option-danger input:checked + .radio,
.admin-form .option-danger input:focus + .radio {
border-color: #e9573f;
}
.admin-form .option-danger input:checked + .radio:before,
.admin-form .option-danger input:focus + .radio:before {
background: #e9573f;
}
.admin-form .option-danger input:checked + .checkbox:before,
.admin-form .option-danger input:focus + .checkbox:before {
border-color: #e9573f;
}
.admin-form .switch-danger > input:checked + label {
background: #e9573f;
border-color: #e9573f;
}
.admin-form .switch-danger > input:checked + label:after {
color: #e9573f;
}
.admin-form .switch-danger > input:checked:focus + label {
background: #e63c21;
border-color: #e63c21;
}
.admin-form .btn-danger {
background-color: #e9573f;
}
.admin-form .btn-danger:hover,
.admin-form .btn-danger:focus {
background-color: #fc6e51;
border-color: #fc6e51;
}
.admin-form .btn-danger:active {
background-color: #e63c21;
}
.admin-form .btn-danger,
.admin-form .btn-danger:hover,
.admin-form .btn-danger:focus,
.admin-form .btn-danger:active {
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.08);
}
.admin-form .slider-wrapper.slider-danger .ui-slider .ui-slider-range {
background-color: #e9573f;
}
.admin-form .slider-wrapper.slider-danger .ui-slider .ui-slider-handle {
border-color: #e9573f;
}
.admin-form .slider-wrapper.slider-danger .ui-slider .ui-slider-handle:before {
background-color: #e9573f;
}
.admin-form.theme-danger .section-divider span {
color: #e9573f;
}
.admin-form.theme-danger .tagline span {
color: #e9573f;
}
.admin-form.theme-danger .theme-link {
color: #e9573f;
}
.admin-form.theme-danger .gui-input:hover,
.admin-form.theme-danger .gui-textarea:hover,
.admin-form.theme-danger .select > select:hover,
.admin-form.theme-danger .select-multiple select:hover,
.admin-form.theme-danger .gui-input:hover ~ .input-footer,
.admin-form.theme-danger .file .gui-file:hover + .gui-input,
.admin-form.theme-danger .gui-textarea:hover ~ .input-footer {
border-color: #fc6e51;
}
.admin-form.theme-danger .gui-input:focus,
.admin-form.theme-danger .gui-textarea:focus,
.admin-form.theme-danger .select > select:focus,
.admin-form.theme-danger .select-multiple select:focus {
border-color: #fc6e51;
color: #3C3C3C;
}
.admin-form.theme-danger .gui-textarea:focus {
height: 120px;
}
.admin-form.theme-danger .select > select:focus {
z-index: 10;
z-index: 20\9;
}
.admin-form.theme-danger .gui-input:focus ~ .field-icon i,
.admin-form.theme-danger .gui-textarea:focus ~ .field-icon i {
color: #e9573f;
}
.admin-form.theme-danger .select-multiple select:focus,
.admin-form.theme-danger .gui-input:focus ~ .input-footer,
.admin-form.theme-danger .gui-textarea:focus ~ .input-footer,
.admin-form.theme-danger .file .gui-file:focus + .gui-input {
border-color: #fc6e51;
}
.admin-form.theme-danger .select > select:focus + .arrow {
color: #e9573f;
}
.admin-form.theme-danger .rating:hover .rating-star:hover,
.admin-form.theme-danger .rating:hover .rating-star:hover ~ .rating-star,
.admin-form.theme-danger .rating-input:checked ~ .rating-star {
color: #e9573f;
}
.admin-form.theme-danger .rating-star,
.admin-form.theme-danger .rating:hover .rating-star {
color: #A2A6A8;
}
.admin-form.theme-danger .ui-datepicker .ui-datepicker-prev,
.admin-form.theme-danger .ui-datepicker .ui-datepicker-next,
.admin-form.theme-danger .ui-datepicker .ui-datepicker-title {
color: #e9573f;
}
.admin-form.theme-danger .ui-datepicker-today a,
.admin-form.theme-danger .ui-datepicker-today a:hover,
.admin-form.theme-danger .ui-datepicker .ui-state-highlight {
background: #f3a79b !important;
}
.admin-form.theme-danger .ui-datepicker .ui-state-active {
background: #e9573f !important;
}
.admin-form.theme-danger .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-active {
background: #FFF !important;
}
.admin-form.theme-danger .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle {
border-color: #e9573f;
}
.admin-form.theme-danger .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle:before {
background-color: #e9573f;
}
.admin-form.theme-danger .wizard .steps li a,
.admin-form.theme-danger .wizard .actions li a {
background-color: #e9573f;
}
.admin-form.theme-danger .wizard .steps li.current a {
background-color: #e63c21;
}

View File

@@ -0,0 +1,168 @@
/* This file creates the AdminForm "theme-dark" skin.
* The success color is applied to every form element and widget
* via the styles generated by the admin-skins.less mixin
*/
.admin-form .panel-dark > .panel-heading {
border-top-color: #424759;
}
.admin-form .panel-dark > .panel-heading:before {
background-color: #3b3f4f;
}
.admin-form .panel-dark.heading-border:before,
.admin-form .panel-dark .heading-border:before {
background-color: #3b3f4f;
}
.admin-form .bg-dark {
background-color: #3b3f4f;
}
.admin-form .bg-dark.light {
background-color: #424759;
}
.admin-form .bg-dark.lighter {
background-color: #51566c;
}
.admin-form .bg-dark.dark {
background-color: #2c2f3c;
}
.admin-form .bg-dark.darker {
background-color: #1e2028;
}
.admin-form .option-dark input:hover + .checkbox,
.admin-form .option-dark input:hover + .radio {
border-color: #424759;
}
.admin-form .option-dark input:checked + .checkbox,
.admin-form .option-dark input:focus + .checkbox,
.admin-form .option-dark input:checked + .radio,
.admin-form .option-dark input:focus + .radio {
border-color: #3b3f4f;
}
.admin-form .option-dark input:checked + .radio:before,
.admin-form .option-dark input:focus + .radio:before {
background: #3b3f4f;
}
.admin-form .option-dark input:checked + .checkbox:before,
.admin-form .option-dark input:focus + .checkbox:before {
border-color: #3b3f4f;
}
.admin-form .switch-dark > input:checked + label {
background: #3b3f4f;
border-color: #3b3f4f;
}
.admin-form .switch-dark > input:checked + label:after {
color: #3b3f4f;
}
.admin-form .switch-dark > input:checked:focus + label {
background: #2c2f3c;
border-color: #2c2f3c;
}
.admin-form .btn-dark {
background-color: #3b3f4f;
}
.admin-form .btn-dark:hover,
.admin-form .btn-dark:focus {
background-color: #424759;
border-color: #424759;
}
.admin-form .btn-dark:active {
background-color: #2c2f3c;
}
.admin-form .btn-dark,
.admin-form .btn-dark:hover,
.admin-form .btn-dark:focus,
.admin-form .btn-dark:active {
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.08);
}
.admin-form .slider-wrapper.slider-dark .ui-slider .ui-slider-range {
background-color: #3b3f4f;
}
.admin-form .slider-wrapper.slider-dark .ui-slider .ui-slider-handle {
border-color: #3b3f4f;
}
.admin-form .slider-wrapper.slider-dark .ui-slider .ui-slider-handle:before {
background-color: #3b3f4f;
}
.admin-form.theme-dark .section-divider span {
color: #3b3f4f;
}
.admin-form.theme-dark .tagline span {
color: #3b3f4f;
}
.admin-form.theme-dark .theme-link {
color: #3b3f4f;
}
.admin-form.theme-dark .gui-input:hover,
.admin-form.theme-dark .gui-textarea:hover,
.admin-form.theme-dark .select > select:hover,
.admin-form.theme-dark .select-multiple select:hover,
.admin-form.theme-dark .gui-input:hover ~ .input-footer,
.admin-form.theme-dark .file .gui-file:hover + .gui-input,
.admin-form.theme-dark .gui-textarea:hover ~ .input-footer {
border-color: #424759;
}
.admin-form.theme-dark .gui-input:focus,
.admin-form.theme-dark .gui-textarea:focus,
.admin-form.theme-dark .select > select:focus,
.admin-form.theme-dark .select-multiple select:focus {
border-color: #424759;
color: #3C3C3C;
}
.admin-form.theme-dark .gui-textarea:focus {
height: 120px;
}
.admin-form.theme-dark .select > select:focus {
z-index: 10;
z-index: 20\9;
}
.admin-form.theme-dark .gui-input:focus ~ .field-icon i,
.admin-form.theme-dark .gui-textarea:focus ~ .field-icon i {
color: #3b3f4f;
}
.admin-form.theme-dark .select-multiple select:focus,
.admin-form.theme-dark .gui-input:focus ~ .input-footer,
.admin-form.theme-dark .gui-textarea:focus ~ .input-footer,
.admin-form.theme-dark .file .gui-file:focus + .gui-input {
border-color: #424759;
}
.admin-form.theme-dark .select > select:focus + .arrow {
color: #3b3f4f;
}
.admin-form.theme-dark .rating:hover .rating-star:hover,
.admin-form.theme-dark .rating:hover .rating-star:hover ~ .rating-star,
.admin-form.theme-dark .rating-input:checked ~ .rating-star {
color: #3b3f4f;
}
.admin-form.theme-dark .rating-star,
.admin-form.theme-dark .rating:hover .rating-star {
color: #A2A6A8;
}
.admin-form.theme-dark .ui-datepicker .ui-datepicker-prev,
.admin-form.theme-dark .ui-datepicker .ui-datepicker-next,
.admin-form.theme-dark .ui-datepicker .ui-datepicker-title {
color: #3b3f4f;
}
.admin-form.theme-dark .ui-datepicker-today a,
.admin-form.theme-dark .ui-datepicker-today a:hover,
.admin-form.theme-dark .ui-datepicker .ui-state-highlight {
background: #676e89 !important;
}
.admin-form.theme-dark .ui-datepicker .ui-state-active {
background: #3b3f4f !important;
}
.admin-form.theme-dark .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-active {
background: #FFF !important;
}
.admin-form.theme-dark .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle {
border-color: #3b3f4f;
}
.admin-form.theme-dark .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle:before {
background-color: #3b3f4f;
}
.admin-form.theme-dark .wizard .steps li a,
.admin-form.theme-dark .wizard .actions li a {
background-color: #3b3f4f;
}
.admin-form.theme-dark .wizard .steps li.current a {
background-color: #2c2f3c;
}

View File

@@ -0,0 +1,168 @@
/* This file creates the AdminForm "theme-info" skin.
* The success color is applied to every form element and widget
* via the styles generated by the admin-skins.less mixin
*/
.admin-form .panel-info > .panel-heading {
border-top-color: #4fc1e9;
}
.admin-form .panel-info > .panel-heading:before {
background-color: #3bafda;
}
.admin-form .panel-info.heading-border:before,
.admin-form .panel-info .heading-border:before {
background-color: #3bafda;
}
.admin-form .bg-info {
background-color: #3bafda;
}
.admin-form .bg-info.light {
background-color: #4fc1e9;
}
.admin-form .bg-info.lighter {
background-color: #74c6e5;
}
.admin-form .bg-info.dark {
background-color: #27a0cc;
}
.admin-form .bg-info.darker {
background-color: #2189b0;
}
.admin-form .option-info input:hover + .checkbox,
.admin-form .option-info input:hover + .radio {
border-color: #4fc1e9;
}
.admin-form .option-info input:checked + .checkbox,
.admin-form .option-info input:focus + .checkbox,
.admin-form .option-info input:checked + .radio,
.admin-form .option-info input:focus + .radio {
border-color: #3bafda;
}
.admin-form .option-info input:checked + .radio:before,
.admin-form .option-info input:focus + .radio:before {
background: #3bafda;
}
.admin-form .option-info input:checked + .checkbox:before,
.admin-form .option-info input:focus + .checkbox:before {
border-color: #3bafda;
}
.admin-form .switch-info > input:checked + label {
background: #3bafda;
border-color: #3bafda;
}
.admin-form .switch-info > input:checked + label:after {
color: #3bafda;
}
.admin-form .switch-info > input:checked:focus + label {
background: #27a0cc;
border-color: #27a0cc;
}
.admin-form .btn-info {
background-color: #3bafda;
}
.admin-form .btn-info:hover,
.admin-form .btn-info:focus {
background-color: #4fc1e9;
border-color: #4fc1e9;
}
.admin-form .btn-info:active {
background-color: #27a0cc;
}
.admin-form .btn-info,
.admin-form .btn-info:hover,
.admin-form .btn-info:focus,
.admin-form .btn-info:active {
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.08);
}
.admin-form .slider-wrapper.slider-info .ui-slider .ui-slider-range {
background-color: #3bafda;
}
.admin-form .slider-wrapper.slider-info .ui-slider .ui-slider-handle {
border-color: #3bafda;
}
.admin-form .slider-wrapper.slider-info .ui-slider .ui-slider-handle:before {
background-color: #3bafda;
}
.admin-form.theme-info .section-divider span {
color: #3bafda;
}
.admin-form.theme-info .tagline span {
color: #3bafda;
}
.admin-form.theme-info .theme-link {
color: #3bafda;
}
.admin-form.theme-info .gui-input:hover,
.admin-form.theme-info .gui-textarea:hover,
.admin-form.theme-info .select > select:hover,
.admin-form.theme-info .select-multiple select:hover,
.admin-form.theme-info .gui-input:hover ~ .input-footer,
.admin-form.theme-info .file .gui-file:hover + .gui-input,
.admin-form.theme-info .gui-textarea:hover ~ .input-footer {
border-color: #4fc1e9;
}
.admin-form.theme-info .gui-input:focus,
.admin-form.theme-info .gui-textarea:focus,
.admin-form.theme-info .select > select:focus,
.admin-form.theme-info .select-multiple select:focus {
border-color: #4fc1e9;
color: #3C3C3C;
}
.admin-form.theme-info .gui-textarea:focus {
height: 120px;
}
.admin-form.theme-info .select > select:focus {
z-index: 10;
z-index: 20\9;
}
.admin-form.theme-info .gui-input:focus ~ .field-icon i,
.admin-form.theme-info .gui-textarea:focus ~ .field-icon i {
color: #3bafda;
}
.admin-form.theme-info .select-multiple select:focus,
.admin-form.theme-info .gui-input:focus ~ .input-footer,
.admin-form.theme-info .gui-textarea:focus ~ .input-footer,
.admin-form.theme-info .file .gui-file:focus + .gui-input {
border-color: #4fc1e9;
}
.admin-form.theme-info .select > select:focus + .arrow {
color: #3bafda;
}
.admin-form.theme-info .rating:hover .rating-star:hover,
.admin-form.theme-info .rating:hover .rating-star:hover ~ .rating-star,
.admin-form.theme-info .rating-input:checked ~ .rating-star {
color: #3bafda;
}
.admin-form.theme-info .rating-star,
.admin-form.theme-info .rating:hover .rating-star {
color: #A2A6A8;
}
.admin-form.theme-info .ui-datepicker .ui-datepicker-prev,
.admin-form.theme-info .ui-datepicker .ui-datepicker-next,
.admin-form.theme-info .ui-datepicker .ui-datepicker-title {
color: #3bafda;
}
.admin-form.theme-info .ui-datepicker-today a,
.admin-form.theme-info .ui-datepicker-today a:hover,
.admin-form.theme-info .ui-datepicker .ui-state-highlight {
background: #91d2ea !important;
}
.admin-form.theme-info .ui-datepicker .ui-state-active {
background: #3bafda !important;
}
.admin-form.theme-info .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-active {
background: #FFF !important;
}
.admin-form.theme-info .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle {
border-color: #3bafda;
}
.admin-form.theme-info .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle:before {
background-color: #3bafda;
}
.admin-form.theme-info .wizard .steps li a,
.admin-form.theme-info .wizard .actions li a {
background-color: #3bafda;
}
.admin-form.theme-info .wizard .steps li.current a {
background-color: #27a0cc;
}

View File

@@ -0,0 +1,168 @@
/* This file creates the AdminForm "theme-primary" skin.
* The success color is applied to every form element and widget
* via the styles generated by the admin-skins.less mixin
*/
.admin-form .panel-primary > .panel-heading {
border-top-color: #5d9cec;
}
.admin-form .panel-primary > .panel-heading:before {
background-color: #4a89dc;
}
.admin-form .panel-primary.heading-border:before,
.admin-form .panel-primary .heading-border:before {
background-color: #4a89dc;
}
.admin-form .bg-primary {
background-color: #4a89dc;
}
.admin-form .bg-primary.light {
background-color: #5d9cec;
}
.admin-form .bg-primary.lighter {
background-color: #83aee7;
}
.admin-form .bg-primary.dark {
background-color: #2e76d6;
}
.admin-form .bg-primary.darker {
background-color: #2567bd;
}
.admin-form .option-primary input:hover + .checkbox,
.admin-form .option-primary input:hover + .radio {
border-color: #5d9cec;
}
.admin-form .option-primary input:checked + .checkbox,
.admin-form .option-primary input:focus + .checkbox,
.admin-form .option-primary input:checked + .radio,
.admin-form .option-primary input:focus + .radio {
border-color: #4a89dc;
}
.admin-form .option-primary input:checked + .radio:before,
.admin-form .option-primary input:focus + .radio:before {
background: #4a89dc;
}
.admin-form .option-primary input:checked + .checkbox:before,
.admin-form .option-primary input:focus + .checkbox:before {
border-color: #4a89dc;
}
.admin-form .switch-primary > input:checked + label {
background: #4a89dc;
border-color: #4a89dc;
}
.admin-form .switch-primary > input:checked + label:after {
color: #4a89dc;
}
.admin-form .switch-primary > input:checked:focus + label {
background: #2e76d6;
border-color: #2e76d6;
}
.admin-form .btn-primary {
background-color: #4a89dc;
}
.admin-form .btn-primary:hover,
.admin-form .btn-primary:focus {
background-color: #5d9cec;
border-color: #5d9cec;
}
.admin-form .btn-primary:active {
background-color: #2e76d6;
}
.admin-form .btn-primary,
.admin-form .btn-primary:hover,
.admin-form .btn-primary:focus,
.admin-form .btn-primary:active {
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.08);
}
.admin-form .slider-wrapper.slider-primary .ui-slider .ui-slider-range {
background-color: #4a89dc;
}
.admin-form .slider-wrapper.slider-primary .ui-slider .ui-slider-handle {
border-color: #4a89dc;
}
.admin-form .slider-wrapper.slider-primary .ui-slider .ui-slider-handle:before {
background-color: #4a89dc;
}
.admin-form.theme-primary .section-divider span {
color: #4a89dc;
}
.admin-form.theme-primary .tagline span {
color: #4a89dc;
}
.admin-form.theme-primary .theme-link {
color: #4a89dc;
}
.admin-form.theme-primary .gui-input:hover,
.admin-form.theme-primary .gui-textarea:hover,
.admin-form.theme-primary .select > select:hover,
.admin-form.theme-primary .select-multiple select:hover,
.admin-form.theme-primary .gui-input:hover ~ .input-footer,
.admin-form.theme-primary .file .gui-file:hover + .gui-input,
.admin-form.theme-primary .gui-textarea:hover ~ .input-footer {
border-color: #5d9cec;
}
.admin-form.theme-primary .gui-input:focus,
.admin-form.theme-primary .gui-textarea:focus,
.admin-form.theme-primary .select > select:focus,
.admin-form.theme-primary .select-multiple select:focus {
border-color: #5d9cec;
color: #3C3C3C;
}
.admin-form.theme-primary .gui-textarea:focus {
height: 120px;
}
.admin-form.theme-primary .select > select:focus {
z-index: 10;
z-index: 20\9;
}
.admin-form.theme-primary .gui-input:focus ~ .field-icon i,
.admin-form.theme-primary .gui-textarea:focus ~ .field-icon i {
color: #4a89dc;
}
.admin-form.theme-primary .select-multiple select:focus,
.admin-form.theme-primary .gui-input:focus ~ .input-footer,
.admin-form.theme-primary .gui-textarea:focus ~ .input-footer,
.admin-form.theme-primary .file .gui-file:focus + .gui-input {
border-color: #5d9cec;
}
.admin-form.theme-primary .select > select:focus + .arrow {
color: #4a89dc;
}
.admin-form.theme-primary .rating:hover .rating-star:hover,
.admin-form.theme-primary .rating:hover .rating-star:hover ~ .rating-star,
.admin-form.theme-primary .rating-input:checked ~ .rating-star {
color: #4a89dc;
}
.admin-form.theme-primary .rating-star,
.admin-form.theme-primary .rating:hover .rating-star {
color: #A2A6A8;
}
.admin-form.theme-primary .ui-datepicker .ui-datepicker-prev,
.admin-form.theme-primary .ui-datepicker .ui-datepicker-next,
.admin-form.theme-primary .ui-datepicker .ui-datepicker-title {
color: #4a89dc;
}
.admin-form.theme-primary .ui-datepicker-today a,
.admin-form.theme-primary .ui-datepicker-today a:hover,
.admin-form.theme-primary .ui-datepicker .ui-state-highlight {
background: #9fc1ed !important;
}
.admin-form.theme-primary .ui-datepicker .ui-state-active {
background: #4a89dc !important;
}
.admin-form.theme-primary .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-active {
background: #FFF !important;
}
.admin-form.theme-primary .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle {
border-color: #4a89dc;
}
.admin-form.theme-primary .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle:before {
background-color: #4a89dc;
}
.admin-form.theme-primary .wizard .steps li a,
.admin-form.theme-primary .wizard .actions li a {
background-color: #4a89dc;
}
.admin-form.theme-primary .wizard .steps li.current a {
background-color: #2e76d6;
}

View File

@@ -0,0 +1,168 @@
/* This file creates the AdminForm "theme-success" skin.
* The success color is applied to every form element and widget
* via the styles generated by the admin-skins.less mixin
*/
.admin-form .panel-success > .panel-heading {
border-top-color: #87d37c;
}
.admin-form .panel-success > .panel-heading:before {
background-color: #70ca63;
}
.admin-form .panel-success.heading-border:before,
.admin-form .panel-success .heading-border:before {
background-color: #70ca63;
}
.admin-form .bg-success {
background-color: #70ca63;
}
.admin-form .bg-success.light {
background-color: #87d37c;
}
.admin-form .bg-success.lighter {
background-color: #9edc95;
}
.admin-form .bg-success.dark {
background-color: #58c249;
}
.admin-form .bg-success.darker {
background-color: #49ae3b;
}
.admin-form .option-success input:hover + .checkbox,
.admin-form .option-success input:hover + .radio {
border-color: #87d37c;
}
.admin-form .option-success input:checked + .checkbox,
.admin-form .option-success input:focus + .checkbox,
.admin-form .option-success input:checked + .radio,
.admin-form .option-success input:focus + .radio {
border-color: #70ca63;
}
.admin-form .option-success input:checked + .radio:before,
.admin-form .option-success input:focus + .radio:before {
background: #70ca63;
}
.admin-form .option-success input:checked + .checkbox:before,
.admin-form .option-success input:focus + .checkbox:before {
border-color: #70ca63;
}
.admin-form .switch-success > input:checked + label {
background: #70ca63;
border-color: #70ca63;
}
.admin-form .switch-success > input:checked + label:after {
color: #70ca63;
}
.admin-form .switch-success > input:checked:focus + label {
background: #58c249;
border-color: #58c249;
}
.admin-form .btn-success {
background-color: #70ca63;
}
.admin-form .btn-success:hover,
.admin-form .btn-success:focus {
background-color: #87d37c;
border-color: #87d37c;
}
.admin-form .btn-success:active {
background-color: #58c249;
}
.admin-form .btn-success,
.admin-form .btn-success:hover,
.admin-form .btn-success:focus,
.admin-form .btn-success:active {
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.08);
}
.admin-form .slider-wrapper.slider-success .ui-slider .ui-slider-range {
background-color: #70ca63;
}
.admin-form .slider-wrapper.slider-success .ui-slider .ui-slider-handle {
border-color: #70ca63;
}
.admin-form .slider-wrapper.slider-success .ui-slider .ui-slider-handle:before {
background-color: #70ca63;
}
.admin-form.theme-success .section-divider span {
color: #70ca63;
}
.admin-form.theme-success .tagline span {
color: #70ca63;
}
.admin-form.theme-success .theme-link {
color: #70ca63;
}
.admin-form.theme-success .gui-input:hover,
.admin-form.theme-success .gui-textarea:hover,
.admin-form.theme-success .select > select:hover,
.admin-form.theme-success .select-multiple select:hover,
.admin-form.theme-success .gui-input:hover ~ .input-footer,
.admin-form.theme-success .file .gui-file:hover + .gui-input,
.admin-form.theme-success .gui-textarea:hover ~ .input-footer {
border-color: #87d37c;
}
.admin-form.theme-success .gui-input:focus,
.admin-form.theme-success .gui-textarea:focus,
.admin-form.theme-success .select > select:focus,
.admin-form.theme-success .select-multiple select:focus {
border-color: #87d37c;
color: #3C3C3C;
}
.admin-form.theme-success .gui-textarea:focus {
height: 120px;
}
.admin-form.theme-success .select > select:focus {
z-index: 10;
z-index: 20\9;
}
.admin-form.theme-success .gui-input:focus ~ .field-icon i,
.admin-form.theme-success .gui-textarea:focus ~ .field-icon i {
color: #70ca63;
}
.admin-form.theme-success .select-multiple select:focus,
.admin-form.theme-success .gui-input:focus ~ .input-footer,
.admin-form.theme-success .gui-textarea:focus ~ .input-footer,
.admin-form.theme-success .file .gui-file:focus + .gui-input {
border-color: #87d37c;
}
.admin-form.theme-success .select > select:focus + .arrow {
color: #70ca63;
}
.admin-form.theme-success .rating:hover .rating-star:hover,
.admin-form.theme-success .rating:hover .rating-star:hover ~ .rating-star,
.admin-form.theme-success .rating-input:checked ~ .rating-star {
color: #70ca63;
}
.admin-form.theme-success .rating-star,
.admin-form.theme-success .rating:hover .rating-star {
color: #A2A6A8;
}
.admin-form.theme-success .ui-datepicker .ui-datepicker-prev,
.admin-form.theme-success .ui-datepicker .ui-datepicker-next,
.admin-form.theme-success .ui-datepicker .ui-datepicker-title {
color: #70ca63;
}
.admin-form.theme-success .ui-datepicker-today a,
.admin-form.theme-success .ui-datepicker-today a:hover,
.admin-form.theme-success .ui-datepicker .ui-state-highlight {
background: #b6e4af !important;
}
.admin-form.theme-success .ui-datepicker .ui-state-active {
background: #70ca63 !important;
}
.admin-form.theme-success .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-active {
background: #FFF !important;
}
.admin-form.theme-success .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle {
border-color: #70ca63;
}
.admin-form.theme-success .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle:before {
background-color: #70ca63;
}
.admin-form.theme-success .wizard .steps li a,
.admin-form.theme-success .wizard .actions li a {
background-color: #70ca63;
}
.admin-form.theme-success .wizard .steps li.current a {
background-color: #58c249;
}

View File

@@ -0,0 +1,168 @@
/* This file creates the AdminForm "theme-system" skin.
* The success color is applied to every form element and widget
* via the styles generated by the admin-skins.less mixin
*/
.admin-form .panel-system > .panel-heading {
border-top-color: #48cfad;
}
.admin-form .panel-system > .panel-heading:before {
background-color: #37bc9b;
}
.admin-form .panel-system.heading-border:before,
.admin-form .panel-system .heading-border:before {
background-color: #37bc9b;
}
.admin-form .bg-system {
background-color: #37bc9b;
}
.admin-form .bg-system.light {
background-color: #48cfad;
}
.admin-form .bg-system.lighter {
background-color: #65d2b7;
}
.admin-form .bg-system.dark {
background-color: #2fa285;
}
.admin-form .bg-system.darker {
background-color: #288770;
}
.admin-form .option-system input:hover + .checkbox,
.admin-form .option-system input:hover + .radio {
border-color: #48cfad;
}
.admin-form .option-system input:checked + .checkbox,
.admin-form .option-system input:focus + .checkbox,
.admin-form .option-system input:checked + .radio,
.admin-form .option-system input:focus + .radio {
border-color: #37bc9b;
}
.admin-form .option-system input:checked + .radio:before,
.admin-form .option-system input:focus + .radio:before {
background: #37bc9b;
}
.admin-form .option-system input:checked + .checkbox:before,
.admin-form .option-system input:focus + .checkbox:before {
border-color: #37bc9b;
}
.admin-form .switch-system > input:checked + label {
background: #37bc9b;
border-color: #37bc9b;
}
.admin-form .switch-system > input:checked + label:after {
color: #37bc9b;
}
.admin-form .switch-system > input:checked:focus + label {
background: #2fa285;
border-color: #2fa285;
}
.admin-form .btn-system {
background-color: #37bc9b;
}
.admin-form .btn-system:hover,
.admin-form .btn-system:focus {
background-color: #48cfad;
border-color: #48cfad;
}
.admin-form .btn-system:active {
background-color: #2fa285;
}
.admin-form .btn-system,
.admin-form .btn-system:hover,
.admin-form .btn-system:focus,
.admin-form .btn-system:active {
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.08);
}
.admin-form .slider-wrapper.slider-system .ui-slider .ui-slider-range {
background-color: #37bc9b;
}
.admin-form .slider-wrapper.slider-system .ui-slider .ui-slider-handle {
border-color: #37bc9b;
}
.admin-form .slider-wrapper.slider-system .ui-slider .ui-slider-handle:before {
background-color: #37bc9b;
}
.admin-form.theme-system .section-divider span {
color: #37bc9b;
}
.admin-form.theme-system .tagline span {
color: #37bc9b;
}
.admin-form.theme-system .theme-link {
color: #37bc9b;
}
.admin-form.theme-system .gui-input:hover,
.admin-form.theme-system .gui-textarea:hover,
.admin-form.theme-system .select > select:hover,
.admin-form.theme-system .select-multiple select:hover,
.admin-form.theme-system .gui-input:hover ~ .input-footer,
.admin-form.theme-system .file .gui-file:hover + .gui-input,
.admin-form.theme-system .gui-textarea:hover ~ .input-footer {
border-color: #48cfad;
}
.admin-form.theme-system .gui-input:focus,
.admin-form.theme-system .gui-textarea:focus,
.admin-form.theme-system .select > select:focus,
.admin-form.theme-system .select-multiple select:focus {
border-color: #48cfad;
color: #3C3C3C;
}
.admin-form.theme-system .gui-textarea:focus {
height: 120px;
}
.admin-form.theme-system .select > select:focus {
z-index: 10;
z-index: 20\9;
}
.admin-form.theme-system .gui-input:focus ~ .field-icon i,
.admin-form.theme-system .gui-textarea:focus ~ .field-icon i {
color: #37bc9b;
}
.admin-form.theme-system .select-multiple select:focus,
.admin-form.theme-system .gui-input:focus ~ .input-footer,
.admin-form.theme-system .gui-textarea:focus ~ .input-footer,
.admin-form.theme-system .file .gui-file:focus + .gui-input {
border-color: #48cfad;
}
.admin-form.theme-system .select > select:focus + .arrow {
color: #37bc9b;
}
.admin-form.theme-system .rating:hover .rating-star:hover,
.admin-form.theme-system .rating:hover .rating-star:hover ~ .rating-star,
.admin-form.theme-system .rating-input:checked ~ .rating-star {
color: #37bc9b;
}
.admin-form.theme-system .rating-star,
.admin-form.theme-system .rating:hover .rating-star {
color: #A2A6A8;
}
.admin-form.theme-system .ui-datepicker .ui-datepicker-prev,
.admin-form.theme-system .ui-datepicker .ui-datepicker-next,
.admin-form.theme-system .ui-datepicker .ui-datepicker-title {
color: #37bc9b;
}
.admin-form.theme-system .ui-datepicker-today a,
.admin-form.theme-system .ui-datepicker-today a:hover,
.admin-form.theme-system .ui-datepicker .ui-state-highlight {
background: #7fdac3 !important;
}
.admin-form.theme-system .ui-datepicker .ui-state-active {
background: #37bc9b !important;
}
.admin-form.theme-system .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-active {
background: #FFF !important;
}
.admin-form.theme-system .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle {
border-color: #37bc9b;
}
.admin-form.theme-system .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle:before {
background-color: #37bc9b;
}
.admin-form.theme-system .wizard .steps li a,
.admin-form.theme-system .wizard .actions li a {
background-color: #37bc9b;
}
.admin-form.theme-system .wizard .steps li.current a {
background-color: #2fa285;
}

View File

@@ -0,0 +1,168 @@
/* This file creates the AdminForm "theme-warning" skin.
* The success color is applied to every form element and widget
* via the styles generated by the admin-skins.less mixin
*/
.admin-form .panel-warning > .panel-heading {
border-top-color: #ffce54;
}
.admin-form .panel-warning > .panel-heading:before {
background-color: #f6bb42;
}
.admin-form .panel-warning.heading-border:before,
.admin-form .panel-warning .heading-border:before {
background-color: #f6bb42;
}
.admin-form .bg-warning {
background-color: #f6bb42;
}
.admin-form .bg-warning.light {
background-color: #ffce54;
}
.admin-form .bg-warning.lighter {
background-color: #f9d283;
}
.admin-form .bg-warning.dark {
background-color: #f4af22;
}
.admin-form .bg-warning.darker {
background-color: #d9950a;
}
.admin-form .option-warning input:hover + .checkbox,
.admin-form .option-warning input:hover + .radio {
border-color: #ffce54;
}
.admin-form .option-warning input:checked + .checkbox,
.admin-form .option-warning input:focus + .checkbox,
.admin-form .option-warning input:checked + .radio,
.admin-form .option-warning input:focus + .radio {
border-color: #f6bb42;
}
.admin-form .option-warning input:checked + .radio:before,
.admin-form .option-warning input:focus + .radio:before {
background: #f6bb42;
}
.admin-form .option-warning input:checked + .checkbox:before,
.admin-form .option-warning input:focus + .checkbox:before {
border-color: #f6bb42;
}
.admin-form .switch-warning > input:checked + label {
background: #f6bb42;
border-color: #f6bb42;
}
.admin-form .switch-warning > input:checked + label:after {
color: #f6bb42;
}
.admin-form .switch-warning > input:checked:focus + label {
background: #f4af22;
border-color: #f4af22;
}
.admin-form .btn-warning {
background-color: #f6bb42;
}
.admin-form .btn-warning:hover,
.admin-form .btn-warning:focus {
background-color: #ffce54;
border-color: #ffce54;
}
.admin-form .btn-warning:active {
background-color: #f4af22;
}
.admin-form .btn-warning,
.admin-form .btn-warning:hover,
.admin-form .btn-warning:focus,
.admin-form .btn-warning:active {
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.08);
}
.admin-form .slider-wrapper.slider-warning .ui-slider .ui-slider-range {
background-color: #f6bb42;
}
.admin-form .slider-wrapper.slider-warning .ui-slider .ui-slider-handle {
border-color: #f6bb42;
}
.admin-form .slider-wrapper.slider-warning .ui-slider .ui-slider-handle:before {
background-color: #f6bb42;
}
.admin-form.theme-warning .section-divider span {
color: #f6bb42;
}
.admin-form.theme-warning .tagline span {
color: #f6bb42;
}
.admin-form.theme-warning .theme-link {
color: #f6bb42;
}
.admin-form.theme-warning .gui-input:hover,
.admin-form.theme-warning .gui-textarea:hover,
.admin-form.theme-warning .select > select:hover,
.admin-form.theme-warning .select-multiple select:hover,
.admin-form.theme-warning .gui-input:hover ~ .input-footer,
.admin-form.theme-warning .file .gui-file:hover + .gui-input,
.admin-form.theme-warning .gui-textarea:hover ~ .input-footer {
border-color: #ffce54;
}
.admin-form.theme-warning .gui-input:focus,
.admin-form.theme-warning .gui-textarea:focus,
.admin-form.theme-warning .select > select:focus,
.admin-form.theme-warning .select-multiple select:focus {
border-color: #ffce54;
color: #3C3C3C;
}
.admin-form.theme-warning .gui-textarea:focus {
height: 120px;
}
.admin-form.theme-warning .select > select:focus {
z-index: 10;
z-index: 20\9;
}
.admin-form.theme-warning .gui-input:focus ~ .field-icon i,
.admin-form.theme-warning .gui-textarea:focus ~ .field-icon i {
color: #f6bb42;
}
.admin-form.theme-warning .select-multiple select:focus,
.admin-form.theme-warning .gui-input:focus ~ .input-footer,
.admin-form.theme-warning .gui-textarea:focus ~ .input-footer,
.admin-form.theme-warning .file .gui-file:focus + .gui-input {
border-color: #ffce54;
}
.admin-form.theme-warning .select > select:focus + .arrow {
color: #f6bb42;
}
.admin-form.theme-warning .rating:hover .rating-star:hover,
.admin-form.theme-warning .rating:hover .rating-star:hover ~ .rating-star,
.admin-form.theme-warning .rating-input:checked ~ .rating-star {
color: #f6bb42;
}
.admin-form.theme-warning .rating-star,
.admin-form.theme-warning .rating:hover .rating-star {
color: #A2A6A8;
}
.admin-form.theme-warning .ui-datepicker .ui-datepicker-prev,
.admin-form.theme-warning .ui-datepicker .ui-datepicker-next,
.admin-form.theme-warning .ui-datepicker .ui-datepicker-title {
color: #f6bb42;
}
.admin-form.theme-warning .ui-datepicker-today a,
.admin-form.theme-warning .ui-datepicker-today a:hover,
.admin-form.theme-warning .ui-datepicker .ui-state-highlight {
background: #fbdea3 !important;
}
.admin-form.theme-warning .ui-datepicker .ui-state-active {
background: #f6bb42 !important;
}
.admin-form.theme-warning .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-active {
background: #FFF !important;
}
.admin-form.theme-warning .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle {
border-color: #f6bb42;
}
.admin-form.theme-warning .ui-datepicker .ui-timepicker-div .ui-slider .ui-slider-handle:before {
background-color: #f6bb42;
}
.admin-form.theme-warning .wizard .steps li a,
.admin-form.theme-warning .wizard .actions li a {
background-color: #f6bb42;
}
.admin-form.theme-warning .wizard .steps li.current a {
background-color: #f4af22;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,37 @@
/* Afrikaans initialisation for the jQuery UI date picker plugin. */
/* Written by Renier Pretorius. */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "../datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}(function( datepicker ) {
datepicker.regional['af'] = {
closeText: 'Selekteer',
prevText: 'Vorige',
nextText: 'Volgende',
currentText: 'Vandag',
monthNames: ['Januarie','Februarie','Maart','April','Mei','Junie',
'Julie','Augustus','September','Oktober','November','Desember'],
monthNamesShort: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun',
'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
dayNames: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
dayNamesShort: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
dayNamesMin: ['So','Ma','Di','Wo','Do','Vr','Sa'],
weekHeader: 'Wk',
dateFormat: 'dd/mm/yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
datepicker.setDefaults(datepicker.regional['af']);
return datepicker.regional['af'];
}));

View File

@@ -0,0 +1,37 @@
/* Algerian Arabic Translation for jQuery UI date picker plugin. (can be used for Tunisia)*/
/* Mohamed Cherif BOUCHELAGHEM -- cherifbouchelaghem@yahoo.fr */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "../datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}(function( datepicker ) {
datepicker.regional['ar-DZ'] = {
closeText: 'إغلاق',
prevText: '&#x3C;السابق',
nextText: 'التالي&#x3E;',
currentText: 'اليوم',
monthNames: ['جانفي', 'فيفري', 'مارس', 'أفريل', 'ماي', 'جوان',
'جويلية', 'أوت', 'سبتمبر','أكتوبر', 'نوفمبر', 'ديسمبر'],
monthNamesShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
dayNames: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
dayNamesShort: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
dayNamesMin: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
weekHeader: 'أسبوع',
dateFormat: 'dd/mm/yy',
firstDay: 6,
isRTL: true,
showMonthAfterYear: false,
yearSuffix: ''};
datepicker.setDefaults(datepicker.regional['ar-DZ']);
return datepicker.regional['ar-DZ'];
}));

View File

@@ -0,0 +1,38 @@
/* Arabic Translation for jQuery UI date picker plugin. */
/* Used in most of Arab countries, primarily in Bahrain, Kuwait, Oman, Qatar, Saudi Arabia and the United Arab Emirates, Egypt, Sudan and Yemen. */
/* Written by Mohammed Alshehri -- m@dralshehri.com */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "../datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}(function( datepicker ) {
datepicker.regional['ar'] = {
closeText: 'إغلاق',
prevText: '&#x3C;السابق',
nextText: 'التالي&#x3E;',
currentText: 'اليوم',
monthNames: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو',
'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
monthNamesShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
dayNames: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
dayNamesShort: ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
dayNamesMin: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
weekHeader: 'أسبوع',
dateFormat: 'dd/mm/yy',
firstDay: 0,
isRTL: true,
showMonthAfterYear: false,
yearSuffix: ''};
datepicker.setDefaults(datepicker.regional['ar']);
return datepicker.regional['ar'];
}));

View File

@@ -0,0 +1,37 @@
/* Azerbaijani (UTF-8) initialisation for the jQuery UI date picker plugin. */
/* Written by Jamil Najafov (necefov33@gmail.com). */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "../datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}(function( datepicker ) {
datepicker.regional['az'] = {
closeText: 'Bağla',
prevText: '&#x3C;Geri',
nextText: 'İrəli&#x3E;',
currentText: 'Bugün',
monthNames: ['Yanvar','Fevral','Mart','Aprel','May','İyun',
'İyul','Avqust','Sentyabr','Oktyabr','Noyabr','Dekabr'],
monthNamesShort: ['Yan','Fev','Mar','Apr','May','İyun',
'İyul','Avq','Sen','Okt','Noy','Dek'],
dayNames: ['Bazar','Bazar ertəsi','Çərşənbə axşamı','Çərşənbə','Cümə axşamı','Cümə','Şənbə'],
dayNamesShort: ['B','Be','Ça','Ç','Ca','C','Ş'],
dayNamesMin: ['B','B','Ç','С','Ç','C','Ş'],
weekHeader: 'Hf',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
datepicker.setDefaults(datepicker.regional['az']);
return datepicker.regional['az'];
}));

View File

@@ -0,0 +1,37 @@
/* Belarusian initialisation for the jQuery UI date picker plugin. */
/* Written by Pavel Selitskas <p.selitskas@gmail.com> */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "../datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}(function( datepicker ) {
datepicker.regional['be'] = {
closeText: 'Зачыніць',
prevText: '&larr;Папяр.',
nextText: 'Наст.&rarr;',
currentText: 'Сёньня',
monthNames: ['Студзень','Люты','Сакавік','Красавік','Травень','Чэрвень',
'Ліпень','Жнівень','Верасень','Кастрычнік','Лістапад','Сьнежань'],
monthNamesShort: ['Сту','Лют','Сак','Кра','Тра','Чэр',
'Ліп','Жні','Вер','Кас','Ліс','Сьн'],
dayNames: ['нядзеля','панядзелак','аўторак','серада','чацьвер','пятніца','субота'],
dayNamesShort: ['ндз','пнд','аўт','срд','чцв','птн','сбт'],
dayNamesMin: ['Нд','Пн','Аў','Ср','Чц','Пт','Сб'],
weekHeader: 'Тд',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
datepicker.setDefaults(datepicker.regional['be']);
return datepicker.regional['be'];
}));

View File

@@ -0,0 +1,38 @@
/* Bulgarian initialisation for the jQuery UI date picker plugin. */
/* Written by Stoyan Kyosev (http://svest.org). */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "../datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}(function( datepicker ) {
datepicker.regional['bg'] = {
closeText: 'затвори',
prevText: '&#x3C;назад',
nextText: 'напред&#x3E;',
nextBigText: '&#x3E;&#x3E;',
currentText: 'днес',
monthNames: ['Януари','Февруари','Март','Април','Май','Юни',
'Юли','Август','Септември','Октомври','Ноември','Декември'],
monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни',
'Юли','Авг','Сеп','Окт','Нов','Дек'],
dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'],
dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'],
dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ'],
weekHeader: 'Wk',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
datepicker.setDefaults(datepicker.regional['bg']);
return datepicker.regional['bg'];
}));

View File

@@ -0,0 +1,37 @@
/* Bosnian i18n for the jQuery UI date picker plugin. */
/* Written by Kenan Konjo. */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "../datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}(function( datepicker ) {
datepicker.regional['bs'] = {
closeText: 'Zatvori',
prevText: '&#x3C;',
nextText: '&#x3E;',
currentText: 'Danas',
monthNames: ['Januar','Februar','Mart','April','Maj','Juni',
'Juli','August','Septembar','Oktobar','Novembar','Decembar'],
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
'Jul','Aug','Sep','Okt','Nov','Dec'],
dayNames: ['Nedelja','Ponedeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'],
dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'],
dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'],
weekHeader: 'Wk',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
datepicker.setDefaults(datepicker.regional['bs']);
return datepicker.regional['bs'];
}));

Some files were not shown because too many files have changed in this diff Show More