first commit
This commit is contained in:
54
admin/ajax/articles.php
Normal file
54
admin/ajax/articles.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
$a = \S::get( 'a' );
|
||||
|
||||
if ( $a == 'article_image_delete' )
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas usuwania zdjecia wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( \admin\factory\Articles::delete_img( \S::get( 'image_id' ) ) )
|
||||
$response = [ 'status' => 'ok' ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( $a == 'article_file_delete' )
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas usuwania załącznika wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( \admin\factory\Articles::delete_file( \S::get( 'file_id' ) ) )
|
||||
$response = [ 'status' => 'ok' ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( $a == 'article_image_alt_change' )
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zmiany atrybutu alt zdjęcia wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( \admin\factory\Articles::image_alt_change( \S::get( 'image_id' ), \S::get( 'image_alt' ) ) )
|
||||
$response = [ 'status' => 'ok' ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( $a == 'article_file_name_change' )
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zmiany nazwy załącznika wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( \admin\factory\Articles::file_name_change( \S::get( 'file_id' ), \S::get( 'file_name' ) ) )
|
||||
$response = [ 'status' => 'ok' ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( $a == 'google_url_preview_article' )
|
||||
{
|
||||
if ( \S::get( 'article_id' ) )
|
||||
echo $_SERVER['SERVER_NAME'] . '/a-' . \S::get( 'article_id' ) . '-' . \S::seo( \S::get( 'title' ) );
|
||||
else
|
||||
echo $_SERVER['SERVER_NAME'] . '/a-' . ( \S::max_db_value( 'pp_articles', 'id' ) + 1 ) . '-' . \S::seo( \S::get( 'title' ) );
|
||||
}
|
||||
16
admin/ajax/newsletter.php
Normal file
16
admin/ajax/newsletter.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
$a = \S::get( 'a' );
|
||||
|
||||
if ( $a == 'newsletter-preview' )
|
||||
{
|
||||
$dates = explode( ' - ', \S::get( 'dates' ) );
|
||||
$template = \S::get('template');
|
||||
|
||||
echo \admin\view\Newsletter::preview(
|
||||
\admin\factory\Articles::articles_by_date_add( $dates[0], $dates[1] ),
|
||||
\admin\factory\Settings::settings_details(),
|
||||
\admin\factory\Newsletter::email_template_detalis( $template ),
|
||||
\S::get( 'dates' )
|
||||
);
|
||||
exit;
|
||||
}
|
||||
91
admin/ajax/pages.php
Normal file
91
admin/ajax/pages.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
$a = \S::get('a');
|
||||
|
||||
if ($a == 'save_articles_order') {
|
||||
$response = ['status' => 'error', 'msg' => 'Podczas zapisywania kolejności wyświetlania artykułów wystąpił błąd. Proszę spróbować ponownie.'];
|
||||
|
||||
if (\admin\factory\Pages::save_articles_order(\S::get('page_id'), \S::get('articles')))
|
||||
$response = ['status' => 'ok'];
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($a == 'save_pages_order') {
|
||||
$response = ['status' => 'error', 'msg' => 'Podczas zapisywania kolejności stron wystąpił błąd. Proszę spróbować ponownie.'];
|
||||
|
||||
if (\admin\factory\Pages::save_pages_order(\S::get('menu_id'), \S::get('pages')))
|
||||
$response = ['status' => 'ok'];
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($a == 'generate_seo_link') {
|
||||
$response = ['status' => 'error', 'msg' => 'Podczas generowania pola "seo link" wystąpił błąd. Proszę spróbować ponownie.'];
|
||||
|
||||
if ($seo_link = \admin\factory\Pages::generate_seo_link(\S::get('title'), \S::get('page_id'), \S::get('article_id'), \S::get('lang'), \S::get('pid')))
|
||||
$response = ['status' => 'ok', 'seo_link' => $seo_link];
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($a == 'cookie_menus') {
|
||||
$array = unserialize($_COOKIE['cookie_menus']);
|
||||
|
||||
if ($array[\S::get('menu_id')] == 0)
|
||||
$array[\S::get('menu_id')] = 1;
|
||||
else
|
||||
$array[\S::get('menu_id')] = 0;
|
||||
|
||||
$array = serialize($array);
|
||||
|
||||
setcookie('cookie_menus', $array, time() + 3600 * 24 * 365);
|
||||
}
|
||||
|
||||
if ($a == 'cookie_pages') {
|
||||
$array = unserialize($_COOKIE['cookie_pages']);
|
||||
|
||||
if ($array[\S::get('page_id')] == 0)
|
||||
$array[\S::get('page_id')] = 1;
|
||||
else
|
||||
$array[\S::get('page_id')] = 0;
|
||||
|
||||
$array = serialize($array);
|
||||
|
||||
setcookie('cookie_pages', $array, time() + 3600 * 24 * 365);
|
||||
}
|
||||
|
||||
if ( $a == 'google_url_preview' )
|
||||
{
|
||||
$settings = \front\factory\Settings::settings_details();
|
||||
$structure = $settings['links_structure'];
|
||||
|
||||
if ( $structure )
|
||||
{
|
||||
if ( \S::get( 'page_id' ) )
|
||||
{
|
||||
$seo_link = \admin\factory\Pages::google_url_preview(\S::get('page_id'), \S::get('title'), \S::get('lang_id'), \S::get('pid'), 0, \S::get('seo_link'));
|
||||
echo $seo_link;
|
||||
}
|
||||
else
|
||||
{
|
||||
$seo_link = \admin\factory\Pages::google_url_preview(0, \S::get('title'), \S::get('lang_id'), \S::get('pid'), \S::max_db_value('pp_pages', 'id') + 1, \S::get('seo_link'));
|
||||
echo $seo_link;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( \S::get( 'seo_link' ) )
|
||||
echo \S::get( 'seo_link' );
|
||||
else
|
||||
{
|
||||
if ( \S::get( 'page_id' ) )
|
||||
echo $prefix . 's-' . \S::get('page_id') . '-' . \S::seo(\S::get('title'));
|
||||
else
|
||||
echo $prefix . 's-' . ( \S::max_db_value('pp_pages', 'id') + 1 ) . '-' . \S::seo(\S::get('title'));
|
||||
}
|
||||
}
|
||||
}
|
||||
9
admin/ajax/users.php
Normal file
9
admin/ajax/users.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$a = \S::get( 'a' );
|
||||
|
||||
if ( $a == 'check_login' )
|
||||
{
|
||||
$response = \admin\factory\Users::check_login( \S::get( 'login' ), \S::get( 'user_id' ) );
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
Reference in New Issue
Block a user