|
|
|
|
@@ -3,6 +3,30 @@ class S
|
|
|
|
|
{
|
|
|
|
|
static public function generate_webp_image($file, $compression_quality = 85)
|
|
|
|
|
{
|
|
|
|
|
if ( strpos( $file, 'thumb/' ) !== false )
|
|
|
|
|
{
|
|
|
|
|
$file_tmp = explode( '/', $file );
|
|
|
|
|
|
|
|
|
|
$width = $file_tmp[1];
|
|
|
|
|
if ( empty( $width ) and $width !== '0' )
|
|
|
|
|
$width = 500;
|
|
|
|
|
|
|
|
|
|
$height = $file_tmp[2];
|
|
|
|
|
if ( empty( $height ) and $height !== '0' )
|
|
|
|
|
$height = 500;
|
|
|
|
|
|
|
|
|
|
for ( $i = 0; $i <= 2; $i++ )
|
|
|
|
|
unset( $file_tmp[$i] );
|
|
|
|
|
|
|
|
|
|
$img_src = implode( '/', $file_tmp );
|
|
|
|
|
|
|
|
|
|
$crop_w = $_GET['c_w'];
|
|
|
|
|
$crop_h = $_GET['c_h'];
|
|
|
|
|
|
|
|
|
|
$img_md5 = md5( $img_src . $height . $width . $crop_h . $crop_w );
|
|
|
|
|
$file = 'thumbs/' . $img_md5[0] . '/' . $img_md5[1] . '/' . $img_md5[2] . '/' . $img_md5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!file_exists($file))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
@@ -10,25 +34,24 @@ class S
|
|
|
|
|
if (file_exists($output_file))
|
|
|
|
|
return $output_file;
|
|
|
|
|
|
|
|
|
|
$file_type = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
|
|
|
|
$file_type = mime_content_type( $file );
|
|
|
|
|
|
|
|
|
|
if (function_exists('imagewebp'))
|
|
|
|
|
{
|
|
|
|
|
switch ($file_type)
|
|
|
|
|
{
|
|
|
|
|
case 'jpeg':
|
|
|
|
|
case 'jpg':
|
|
|
|
|
case 'image/jpeg':
|
|
|
|
|
$image = imagecreatefromjpeg($file);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'png':
|
|
|
|
|
case 'image/png':
|
|
|
|
|
$image = imagecreatefrompng($file);
|
|
|
|
|
imagepalettetotruecolor($image);
|
|
|
|
|
imagealphablending($image, true);
|
|
|
|
|
imagesavealpha($image, true);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'gif':
|
|
|
|
|
case 'image/gif':
|
|
|
|
|
$image = imagecreatefromgif($file);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
@@ -594,7 +617,7 @@ class S
|
|
|
|
|
foreach ($available_domains as $domain)
|
|
|
|
|
{
|
|
|
|
|
$site_map[$domain['domain']] = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
|
|
|
|
|
$site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL;
|
|
|
|
|
$site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL;
|
|
|
|
|
$site_map[$domain['domain']] .= '<url>' . PHP_EOL;
|
|
|
|
|
$site_map[$domain['domain']] .= '<loc>' . $domain_prefix . '://' . $www . $domain['domain'] . '</loc>' . PHP_EOL;
|
|
|
|
|
$site_map[$domain['domain']] .= '<lastmod>' . date('Y-m-d') . '</lastmod>' . PHP_EOL;
|
|
|
|
|
@@ -688,7 +711,7 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
|
|
|
|
|
$results2 = $mdb->select(
|
|
|
|
|
'pp_pages_langs',
|
|
|
|
|
['[><]pp_pages'=> ['page_id' => 'id']],
|
|
|
|
|
['[><]pp_pages' => ['page_id' => 'id']],
|
|
|
|
|
['seo_link', 'title', 'page_id', 'noindex', 'start', 'page_type'],
|
|
|
|
|
['AND' => ['status' => 1, 'lang_id' => $row['id'], 'block_direct_access' => 0], 'ORDER' => ['start' => 'DESC', 'o' => 'ASC']]
|
|
|
|
|
);
|
|
|
|
|
@@ -742,7 +765,7 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
$seo = $language_link . \S::seo($row2['seo_link']);
|
|
|
|
|
|
|
|
|
|
$robots .= 'Disallow: /' . $seo . '$' . PHP_EOL;
|
|
|
|
|
$robots .= 'Disallow: /' . $seo . '-s-*' . PHP_EOL;
|
|
|
|
|
$robots .= 'Disallow: /' . $seo . '/s/*' . PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@@ -752,7 +775,7 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
$seo = $language_link . 's-' . $row2['page_id'] . '-' . \S::seo($row2['title']);
|
|
|
|
|
|
|
|
|
|
$robots .= 'Disallow: /' . $seo . '$' . PHP_EOL;
|
|
|
|
|
$robots .= 'Disallow: /' . $seo . '-s-*$' . PHP_EOL;
|
|
|
|
|
$robots .= 'Disallow: /' . $seo . '/s/*$' . PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -761,32 +784,25 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
{
|
|
|
|
|
if ($row['start'] and $row2['start'])
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid|hash)=[^&]+(&.*)?';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]' . PHP_EOL;
|
|
|
|
|
|
|
|
|
|
if ($row2['seo_link'])
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/' . \S::seo($row2['seo_link']) . '$';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^(.*)$ ' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . ' [R=301,L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/' . \S::seo($row2['seo_link']) . '-s-1$';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/' . \S::seo($row2['seo_link']) . '/s/1$';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^(.*)$ ' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . ' [R=301,L]';
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/s-' . $row2['page_id'] . '-' . \S::seo($row2['title']) . '$';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^(.*)$ ' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . ' [R=301,L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/s-' . $row2['page_id'] . '-' . \S::seo($row2['title']) . '-s-1$';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^(.*)$ ' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . ' [R=301,L]';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} "^/$"';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . ' [L]';
|
|
|
|
|
|
|
|
|
|
@@ -800,26 +816,9 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
else
|
|
|
|
|
$seo = $language_link . \S::seo($row2['seo_link']);
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '-s-1$ ' . $seo . ' [R=301,L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '-s-([0-9]+)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&bs=$1&%{QUERY_STRING} [L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} !=""';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ' . $seo . ' %{REQUEST_URI}? [R=301,L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . ' [L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '-s-([0-9]+)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&bs=$1 [L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '(|/)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '/s/1(|/)$ ' . $seo . ' [R=301,L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '/s/([0-9]+)(|/)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&bs=$1&%{QUERY_STRING} [L]';
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@@ -828,26 +827,9 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
else
|
|
|
|
|
$seo = $language_link . 's-' . $row2['page_id'] . '-' . \S::seo($row2['title']);
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '-s-1$ ' . $seo . ' [R=301,L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '-s-([0-9]+)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&bs=$1&%{QUERY_STRING} [L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} !=""';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ' . $seo . ' %{REQUEST_URI}? [R=301,L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . ' [L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $www . $url_tmp . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '-s-([0-9]+)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&bs=$1 [L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '(|/)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '/s/1(|/)$ ' . $seo . ' [R=301,L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '/s/([0-9]+)(|/)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&bs=$1&%{QUERY_STRING} [L]';
|
|
|
|
|
}
|
|
|
|
|
$htaccess_data .= PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
@@ -856,7 +838,7 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
|
|
|
|
|
$results2 = $mdb->select(
|
|
|
|
|
'pp_articles_langs',
|
|
|
|
|
['[><]pp_articles'=> ['article_id' => 'id']],
|
|
|
|
|
['[><]pp_articles' => ['article_id' => 'id']],
|
|
|
|
|
['seo_link', 'title', 'article_id', 'noindex', 'copy_from', 'block_direct_access'],
|
|
|
|
|
['AND' => ['status' => 1, 'lang_id' => $row['id']]]
|
|
|
|
|
);
|
|
|
|
|
@@ -911,29 +893,11 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
{
|
|
|
|
|
if ($row2['seo_link'])
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $domain . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . \S::seo($row2['seo_link']) . '$ index.php?article=' . $row2['article_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $domain . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} !=""';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . \S::seo($row2['seo_link']) . ' %{REQUEST_URI}? [R=301,L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $domain . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . \S::seo($row2['seo_link']) . '$ index.php?article=' . $row2['article_id'] . '&lang=' . $row['id'] . ' [L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . \S::seo($row2['seo_link']) . '(|/)$ index.php?article=' . $row2['article_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
|
|
|
|
|
}
|
|
|
|
|
else if ($row2['title'] != null)
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $domain . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . 'a-' . $row2['article_id'] . '-' . \S::seo($row2['title']) . '$ index.php?article=' . $row2['article_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $domain . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} !=""';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . 'a-' . $row2['article_id'] . '-' . \S::seo($row2['title']) . ' %{REQUEST_URI}? [R=301,L]';
|
|
|
|
|
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{HTTP_HOST} ^' . $domain . '$ [NC]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . 'a-' . $row2['article_id'] . '-' . \S::seo($row2['title']) . '$ index.php?article=' . $row2['article_id'] . '&lang=' . $row['id'] . ' [L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . 'a-' . $row2['article_id'] . '-' . \S::seo($row2['title']) . '(|/)$ index.php?article=' . $row2['article_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
|
|
|
|
|
}
|
|
|
|
|
$htaccess_data .= PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
@@ -951,8 +915,8 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
if (is_array($results) and !empty($results)) foreach ($results as $row)
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} !=""';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule tag,' . \S::seo($row['name']) . ' %{REQUEST_URI}? [R=301,L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^tag,' . \S::seo($row['name']) . '$ index.php?tag=' . $row['tag_id'] . ' [L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule tag/' . \S::seo( $row['name'] ) . '(|/) %{REQUEST_URI}? [R=301,L]';
|
|
|
|
|
$htaccess_data .= PHP_EOL . 'RewriteRule ^tag/' . \S::seo( $row['name'] ) . '(|/)$ index.php?tag=' . $row['tag_id'] . ' [L]';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$results = $mdb->get('pp_settings', 'value', ['param' => 'htaccess']);
|
|
|
|
|
@@ -972,156 +936,185 @@ $site_map[$domain['domain']] .= '<urlset xmlns="http://www.sitemaps.org/schemas/
|
|
|
|
|
$site_map[$domain['domain']] .= '</urlset>';
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
$site_map[$url] .= '
|
|
|
|
|
</urlset>';
|
|
|
|
|
$site_map[$url] .= '</urlset>';
|
|
|
|
|
|
|
|
|
|
if ($settings['ssl'])
|
|
|
|
|
{
|
|
|
|
|
if ($settings['link_version'])
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data = str_replace(
|
|
|
|
|
'{REDIRECT}',
|
|
|
|
|
'RewriteCond %{HTTP_HOST} !^www\.' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
|
|
|
|
|
if ( $settings['ssl'] )
|
|
|
|
|
{
|
|
|
|
|
if ( $settings['link_version'] )
|
|
|
|
|
{
|
|
|
|
|
$redirect = 'RewriteCond %{HTTP_HOST} !^www\.' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{SERVER_PORT} !=443' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL;
|
|
|
|
|
|
|
|
|
|
. 'RewriteCond %{SERVER_PORT} !=443' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
|
|
|
|
|
if ( !$settings['url_version'] )
|
|
|
|
|
$redirect .= '## Remove trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)/$ https://%{HTTP_HOST}/$1 [L,R=301]';
|
|
|
|
|
else
|
|
|
|
|
$redirect .= '## Add trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !(/$|\.)' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]';
|
|
|
|
|
|
|
|
|
|
. '## Remove trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)/$ https://%{HTTP_HOST}/$1 [L,R=301]',
|
|
|
|
|
$htaccess_data
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data = str_replace(
|
|
|
|
|
'{REDIRECT}',
|
|
|
|
|
'RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ https://%1/$1 [R=301,L]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{SERVER_PORT} !=443' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
|
|
|
|
|
$htaccess_data = str_replace( '{REDIRECT}', $redirect, $htaccess_data );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$redirect = 'RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ https://%1/$1 [R=301,L]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{SERVER_PORT} !=443' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL;
|
|
|
|
|
|
|
|
|
|
. '## Remove trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)/$ https://%{HTTP_HOST}/$1 [L,R=301]',
|
|
|
|
|
$htaccess_data
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if ($settings['link_version'])
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data = str_replace(
|
|
|
|
|
'{REDIRECT}',
|
|
|
|
|
'RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
|
|
|
|
|
if ( !$settings['url_version'] )
|
|
|
|
|
$redirect .= '## Remove trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)/$ https://%{HTTP_HOST}/$1 [L,R=301]';
|
|
|
|
|
else
|
|
|
|
|
$redirect .= '## Add trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !(/$|\.)' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]';
|
|
|
|
|
|
|
|
|
|
. 'RewriteCond %{SERVER_PORT} =443' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
|
|
|
|
|
$htaccess_data = str_replace( '{REDIRECT}', $redirect, $htaccess_data );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if ($settings['link_version'])
|
|
|
|
|
{
|
|
|
|
|
$redirect = 'RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{SERVER_PORT} =443' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL;
|
|
|
|
|
|
|
|
|
|
. '## Remove trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [L,R=301]',
|
|
|
|
|
$htaccess_data
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data = str_replace(
|
|
|
|
|
'{REDIRECT}',
|
|
|
|
|
'RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ http://%1/$1 [R=301,L]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{SERVER_PORT} =443' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
|
|
|
|
|
if ( !$settings['url_version'] )
|
|
|
|
|
$redirect .= '## Remove trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [L,R=301]';
|
|
|
|
|
else
|
|
|
|
|
$redirect .= '## Add trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !(/$|\.)' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]';
|
|
|
|
|
|
|
|
|
|
. '## Remove trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [L,R=301]',
|
|
|
|
|
$htaccess_data
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$htaccess_data = str_replace( '{REDIRECT}', $redirect, $htaccess_data );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$redirect = 'RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ http://%1/$1 [R=301,L]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{SERVER_PORT} =443' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL;
|
|
|
|
|
|
|
|
|
|
$additional_classes = file_get_contents('../libraries/additional-classes.ini');
|
|
|
|
|
$additional_classes = explode(PHP_EOL, $additional_classes);
|
|
|
|
|
$additional_classes = array_filter($additional_classes);
|
|
|
|
|
if (is_array($additional_classes) and !empty($additional_classes))
|
|
|
|
|
{
|
|
|
|
|
foreach ($additional_classes as $class)
|
|
|
|
|
{
|
|
|
|
|
$classes .= 'RewriteCond %{REQUEST_URI} ^/' . trim($class) . '/(.*) [NC]' . PHP_EOL;
|
|
|
|
|
$classes .= 'RewriteRule ^([^/]*)/([^/]*)(|/([^/]*))$ index.php?module=$1&action=$2&$4 [L]' . PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$htaccess_data = str_replace('{ADDITIONAL_CLASSES}', $classes, $htaccess_data);
|
|
|
|
|
if ( !$settings['url_version'] )
|
|
|
|
|
$redirect .= '## Remove trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [L,R=301]';
|
|
|
|
|
else
|
|
|
|
|
$redirect .= '## Add trailing slash' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !(/$|\.)' . PHP_EOL
|
|
|
|
|
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
|
|
|
|
|
. 'RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]';
|
|
|
|
|
|
|
|
|
|
/* pozostałe linki */
|
|
|
|
|
$htaccess_data .= PHP_EOL;
|
|
|
|
|
$htaccess_data .= 'RewriteRule ^newsletter/signin$ index.php?module=newsletter&action=signin [L]' . PHP_EOL;
|
|
|
|
|
$htaccess_data .= 'RewriteRule ^newsletter/confirm/hash=(.*)$ index.php?module=newsletter&action=confirm&hash=$1 [L]' . PHP_EOL;
|
|
|
|
|
$htaccess_data .= 'RewriteRule ^newsletter/unsubscribe/hash=(.*)$ index.php?module=newsletter&action=unsubscribe&hash=$1 [L]' . PHP_EOL;
|
|
|
|
|
$htaccess_data = str_replace( '{REDIRECT}', $redirect, $htaccess_data );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* pixieset */
|
|
|
|
|
$results = $mdb->select('pp_articles', 'id', ['pixieset' => 1]);
|
|
|
|
|
if (is_array($results) and count($results))
|
|
|
|
|
{
|
|
|
|
|
$pixieset = 'RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?' . $url_tmp . ' [NC]' . PHP_EOL;
|
|
|
|
|
$pixieset .= 'RewriteCond %{REQUEST_URI} ^(';
|
|
|
|
|
foreach ($results as $row)
|
|
|
|
|
{
|
|
|
|
|
$pixieset .= '/upload/article_images/article_' . $row . '/';
|
|
|
|
|
if ($row != end($results))
|
|
|
|
|
$pixieset .= '|';
|
|
|
|
|
}
|
|
|
|
|
$pixieset .= ') [NC]' . PHP_EOL . 'RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]' . PHP_EOL;
|
|
|
|
|
$additional_classes = file_get_contents('../libraries/additional-classes.ini');
|
|
|
|
|
$additional_classes = explode(PHP_EOL, $additional_classes);
|
|
|
|
|
$additional_classes = array_filter($additional_classes);
|
|
|
|
|
if (is_array($additional_classes) and !empty($additional_classes))
|
|
|
|
|
{
|
|
|
|
|
foreach ($additional_classes as $class)
|
|
|
|
|
{
|
|
|
|
|
$classes .= 'RewriteCond %{REQUEST_URI} ^/' . trim($class) . '/(.*) [NC]' . PHP_EOL;
|
|
|
|
|
$classes .= 'RewriteRule ^([^/]*)/([^/]*)(|/([^/]*))$ index.php?module=$1&action=$2&$4 [L]' . PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$htaccess_data = str_replace('{ADDITIONAL_CLASSES}', $classes, $htaccess_data);
|
|
|
|
|
|
|
|
|
|
$htaccess_data = str_replace('{PIXIESET]', $pixieset, $htaccess_data);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data = str_replace('{PIXIESET]', '', $htaccess_data);
|
|
|
|
|
}
|
|
|
|
|
/* pozostałe linki */
|
|
|
|
|
$htaccess_data .= PHP_EOL;
|
|
|
|
|
$htaccess_data .= 'RewriteRule ^newsletter/signin$ index.php?module=newsletter&action=signin [L]' . PHP_EOL;
|
|
|
|
|
$htaccess_data .= 'RewriteRule ^newsletter/confirm/hash=(.*)$ index.php?module=newsletter&action=confirm&hash=$1 [L]' . PHP_EOL;
|
|
|
|
|
$htaccess_data .= 'RewriteRule ^newsletter/unsubscribe/hash=(.*)$ index.php?module=newsletter&action=unsubscribe&hash=$1 [L]' . PHP_EOL;
|
|
|
|
|
|
|
|
|
|
$fp = fopen($dir . '.htaccess', 'w');
|
|
|
|
|
fwrite($fp, $htaccess_data);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
/* pixieset */
|
|
|
|
|
$results = $mdb->select('pp_articles', 'id', ['pixieset' => 1]);
|
|
|
|
|
if (is_array($results) and count($results))
|
|
|
|
|
{
|
|
|
|
|
$pixieset = 'RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?' . $url_tmp . ' [NC]' . PHP_EOL;
|
|
|
|
|
$pixieset .= 'RewriteCond %{REQUEST_URI} ^(';
|
|
|
|
|
foreach ($results as $row)
|
|
|
|
|
{
|
|
|
|
|
$pixieset .= '/upload/article_images/article_' . $row . '/';
|
|
|
|
|
if ($row != end($results))
|
|
|
|
|
$pixieset .= '|';
|
|
|
|
|
}
|
|
|
|
|
$pixieset .= ') [NC]' . PHP_EOL . 'RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]' . PHP_EOL;
|
|
|
|
|
|
|
|
|
|
$class = '\admin\factory\Sitemap';
|
|
|
|
|
$action = 'sitemap';
|
|
|
|
|
$htaccess_data = str_replace('{PIXIESET]', $pixieset, $htaccess_data);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$htaccess_data = str_replace('{PIXIESET]', '', $htaccess_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (class_exists($class) and method_exists(new $class, $action))
|
|
|
|
|
$site_map = call_user_func_array(array($class, $action), array($site_map, $available_domains, $domain_prefix, $www, $url));
|
|
|
|
|
$fp = fopen($dir . '.htaccess', 'w');
|
|
|
|
|
fwrite($fp, $htaccess_data);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
|
|
|
|
|
if (is_array($available_domains) and !empty($available_domains))
|
|
|
|
|
{
|
|
|
|
|
foreach ($available_domains as $domain)
|
|
|
|
|
{
|
|
|
|
|
$fp = fopen($dir . 'sitemap_' . \S::seo($domain['domain']) . '.xml', 'w');
|
|
|
|
|
fwrite($fp, $site_map[$domain['domain']]);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$fp = fopen($dir . 'sitemap.xml', 'w');
|
|
|
|
|
fwrite($fp, $site_map[$url]);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
}
|
|
|
|
|
$class = '\admin\factory\Sitemap';
|
|
|
|
|
$action = 'sitemap';
|
|
|
|
|
|
|
|
|
|
$fp = fopen($dir . 'robots.txt', 'w');
|
|
|
|
|
fwrite($fp, $robots);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
}
|
|
|
|
|
if (class_exists($class) and method_exists(new $class, $action))
|
|
|
|
|
$site_map = call_user_func_array(array($class, $action), array($site_map, $available_domains, $domain_prefix, $www, $url));
|
|
|
|
|
|
|
|
|
|
public static function seo($val, $delete_rhombs = false)
|
|
|
|
|
{
|
|
|
|
|
$array_rep1 = array('*', '_', ' ', '+', '"', "'", '?', '-', ',', '!', '~', '<', '>' , '@' , '#' , '$' , '%' , '^' , '&' , '*' . '(' , ')' . '-' , '=' , '\\' , '|' , '[' , ']' , ':' , '(' , ')' ); $array_rep2=array('-', '-' , '-' , '-' , '' , '' , '' , '-' , '-' , '' , '-' , '-' , '-' , '-' , '-' , '-' , '-' , '-' , '-' , '-' , '-' , '-' , '' , '-' , '-' , '-' , '-' , '-' , '-' , '-' , '-' ); $val=self::noPl($val); $val=str_replace($array_rep1, $array_rep2, $val); if ($delete_rhombs) $val=str_replace('/', '' , $val); $val=strtolower($val); $val=preg_replace('/(-){2,}/', '-' , $val); $val=ltrim($val, '-' ); $val=rtrim($val, '-' ); return $val; } public static function noPL($string) { $chars=array( // Decompositions for Latin-1 Supplement chr(195).chr(128)=> 'A', chr(195).chr(129) => 'A',
|
|
|
|
|
if (is_array($available_domains) and !empty($available_domains))
|
|
|
|
|
{
|
|
|
|
|
foreach ($available_domains as $domain)
|
|
|
|
|
{
|
|
|
|
|
$fp = fopen($dir . 'sitemap_' . \S::seo($domain['domain']) . '.xml', 'w');
|
|
|
|
|
fwrite($fp, $site_map[$domain['domain']]);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$fp = fopen($dir . 'sitemap.xml', 'w');
|
|
|
|
|
fwrite($fp, $site_map[$url]);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$fp = fopen($dir . 'robots.txt', 'w');
|
|
|
|
|
fwrite($fp, $robots);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function seo( $val, $delete_rhombs = false )
|
|
|
|
|
{
|
|
|
|
|
$array_rep1 = array('*', '_', ' ', '+', '"', "'", '?', '-', ',', '!', '~', '<', '>', '@', '#', '$', '%', '^', '&', '*' . '(', ')' . '-', '=', '\\', '|', '[', ']', ':', '(', ')');
|
|
|
|
|
$array_rep2 = array('-', '-', '-', '-', '', '', '', '-', '-', '', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '', '-', '-', '-', '-', '-', '-', '-', '-');
|
|
|
|
|
$val = self::noPl($val);
|
|
|
|
|
$val = str_replace($array_rep1, $array_rep2, $val);
|
|
|
|
|
if ($delete_rhombs)
|
|
|
|
|
$val = str_replace('/', '', $val);
|
|
|
|
|
|
|
|
|
|
$val = strtolower($val);
|
|
|
|
|
$val = preg_replace('/(-){2,}/', '-', $val);
|
|
|
|
|
$val = ltrim($val, '-');
|
|
|
|
|
$val = rtrim($val, '-');
|
|
|
|
|
return $val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function noPL($string)
|
|
|
|
|
{
|
|
|
|
|
$chars = array( // Decompositions for Latin-1 Supplement chr(195).chr(128)=> 'A', chr(195).chr(129) => 'A',
|
|
|
|
|
chr(195) . chr(130) => 'A', chr(195) . chr(131) => 'A',
|
|
|
|
|
chr(195) . chr(132) => 'A', chr(195) . chr(133) => 'A',
|
|
|
|
|
chr(195) . chr(135) => 'C', chr(195) . chr(136) => 'E',
|
|
|
|
|
@@ -1268,12 +1261,34 @@ $array_rep1 = array('*', '_', ' ', '+', '"', "'", '?', '-', ',', '!', '~', '<',
|
|
|
|
|
|
|
|
|
|
public static function is_empty_dir($dir)
|
|
|
|
|
{
|
|
|
|
|
return (($files = @scandir($dir)) && count($files) <= 2); } public static function email_check($email) { return filter_var($email, FILTER_VALIDATE_EMAIL); } public static function send_email($email, $subject, $text, $replay='' , $file='' ) { global $settings; if (file_exists('libraries/phpmailer/class.phpmailer.php')) require_once 'libraries/phpmailer/class.phpmailer.php' ; if (file_exists('libraries/phpmailer/class.smtp.php')) require_once 'libraries/phpmailer/class.smtp.php' ; if (file_exists('../libraries/phpmailer/class.phpmailer.php')) require_once '../libraries/phpmailer/class.phpmailer.php' ; if (file_exists('../libraries/phpmailer/class.smtp.php')) require_once '../libraries/phpmailer/class.smtp.php' ; if ($email and $subject) { $mail=new PHPMailer(); $mail->IsSMTP();
|
|
|
|
|
$mail->SMTPAuth = true;
|
|
|
|
|
return (($files = @scandir($dir)) && count($files) <= 2);
|
|
|
|
|
}
|
|
|
|
|
public static function email_check($email)
|
|
|
|
|
{
|
|
|
|
|
return filter_var($email, FILTER_VALIDATE_EMAIL);
|
|
|
|
|
}
|
|
|
|
|
public static function send_email($email, $subject, $text, $replay = '', $file = '')
|
|
|
|
|
{
|
|
|
|
|
global $settings;
|
|
|
|
|
if (file_exists('libraries/phpmailer/class.phpmailer.php')) require_once 'libraries/phpmailer/class.phpmailer.php';
|
|
|
|
|
if (file_exists('libraries/phpmailer/class.smtp.php')) require_once 'libraries/phpmailer/class.smtp.php';
|
|
|
|
|
if (file_exists('../libraries/phpmailer/class.phpmailer.php')) require_once '../libraries/phpmailer/class.phpmailer.php';
|
|
|
|
|
if (file_exists('../libraries/phpmailer/class.smtp.php')) require_once '../libraries/phpmailer/class.smtp.php';
|
|
|
|
|
if ($email and $subject)
|
|
|
|
|
{
|
|
|
|
|
$username = trim((string)$settings['email_login']);
|
|
|
|
|
$password = trim((string)$settings['email_password']);
|
|
|
|
|
$use_auth = ($username !== '' || $password !== '');
|
|
|
|
|
|
|
|
|
|
$build_mailer = function ($smtp_auth) use ($settings, $email, $subject, $text, $replay, $file, $username, $password)
|
|
|
|
|
{
|
|
|
|
|
$mail = new PHPMailer();
|
|
|
|
|
$mail->IsSMTP();
|
|
|
|
|
$mail->SMTPAuth = $smtp_auth ? true : false;
|
|
|
|
|
$mail->Host = $settings['email_host'];
|
|
|
|
|
$mail->Port = $settings['email_port'];
|
|
|
|
|
$mail->Username = $settings['email_login'];
|
|
|
|
|
$mail->Password = $settings['email_password'];
|
|
|
|
|
$mail->Username = $username;
|
|
|
|
|
$mail->Password = $password;
|
|
|
|
|
$mail->CharSet = "UTF-8";
|
|
|
|
|
$mail->SMTPOptions = array(
|
|
|
|
|
'ssl' => array(
|
|
|
|
|
@@ -1311,8 +1326,23 @@ $array_rep1 = array('*', '_', ' ', '+', '"', "'", '?', '-', ',', '!', '~', '<',
|
|
|
|
|
$mail->AddAttachment($file);
|
|
|
|
|
}
|
|
|
|
|
$mail->IsHTML(true);
|
|
|
|
|
return $mail->Send();
|
|
|
|
|
|
|
|
|
|
return $mail;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$mail = $build_mailer($use_auth);
|
|
|
|
|
if ($mail->Send())
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if ($use_auth)
|
|
|
|
|
{
|
|
|
|
|
$mail = $build_mailer(false);
|
|
|
|
|
if ($mail->Send())
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|