<?php 
$pt->config->ffmpeg  = is_executable($pt->config->ffmpeg_binary_file);
function isEnabled($func) {
    return is_callable($func) && false === stripos(ini_get('disable_functions'), $func);
}
$enabled = true;
if (!isEnabled('shell_exec')) {
    $enabled = false;
}


?>

<div class="container-fluid">
    <div>
        <h3>General Configuration</h3>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="#">Home</a>
                </li>
                <li class="breadcrumb-item">
                    <a href="#">Settings</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">General Configuration</li>
            </ol>
        </nav>
    </div>
    <!-- Vertical Layout -->
    <div class="row">
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">General Configuration</h6>
                    <div class="video-settings-alert"></div>
                    <form class="video-settings" method="POST">
                          <div class="float-left">
                            <label for="seo_link" class="main-label">SEO Links</label>
                            <br><small class="admin-info">Enable SEO links E.g: site.com/this-is-a-video-_ID.html, this will improve your Google Ranking</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="seo_link" value="off" />
                            <input type="checkbox" name="seo_link" id="chck-seo_link" value="on" <?php echo ($pt->config->seo_link == 'on') ? 'checked': '';?>>
                            <label for="chck-seo_link" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="history_system" class="main-label">History System</label>
                            <br><small class="admin-info">Users will be able to view their watched videos.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="history_system" value="off" />
                            <input type="checkbox" name="history_system" id="chck-history_system" value="on" <?php echo ($pt->config->history_system == 'on') ? 'checked': '';?>>
                            <label for="chck-history_system" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        
                       
                        
                        
                        <div class="float-left">
                            <label for="popular_channels" class="main-label">Popular Channels</label>
                            <br><small class="admin-info">Show popular channels ranked by most subscribers.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="popular_channels" value="off" />
                            <input type="checkbox" name="popular_channels" id="chck-popular_channels" value="on" <?php echo ($pt->config->popular_channels == 'on') ? 'checked': '';?>>
                            <label for="chck-popular_channels" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                       
                        <div class="float-left">
                            <label for="article_system" class="main-label">Article System</label>
                            <br><small class="admin-info">Create articles in blog section.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="article_system" value="off" />
                            <input type="checkbox" name="article_system" id="chck-article_system" value="on" <?php echo ($pt->config->article_system == 'on') ? 'checked': '';?>>
                            <label for="chck-article_system" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="show_articles" class="main-label">Show Articles In Home Page</label>
                            <br><small class="admin-info">Articles will seen in home page. </small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="show_articles" value="off" />
                            <input type="checkbox" name="show_articles" id="chck-show_articles" value="on" <?php echo ($pt->config->show_articles == 'on') ? 'checked': '';?>>
                            <label for="chck-show_articles" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="all_create_articles" class="main-label">Users Can Create Articles</label>
                            <br><small class="admin-info">Allow users to create articles too.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="all_create_articles" value="off" />
                            <input type="checkbox" name="all_create_articles" id="chck-all_create_articles" value="on" <?php echo ($pt->config->all_create_articles == 'on') ? 'checked': '';?>>
                            <label for="chck-all_create_articles" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                       
                       
                        <div class="float-left">
                            <label for="pop_up_18" class="main-label">+18 Pop-up</label>
                            <br><small class="admin-info">Show +18 Pop-up when user access the site.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="pop_up_18" value="off" />
                            <input type="checkbox" name="pop_up_18" id="chck-pop_up_18" value="on" <?php echo ($pt->config->pop_up_18 == 'on') ? 'checked': '';?>>
                            <label for="chck-pop_up_18" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">+18 Block Time</label>
                                <input type="text" name="time_18" class="form-control" value="{{CONFIG time_18}}" oninput="this.value = this.value.replace(/[^1-9.]/g, '').replace(/(\..*)\./g, '$1');">
                                <small class="admin-info">Set the amount of hours to block a user which isn't above 18 years old.</small>
                            </div>
                        </div>
                        <hr>

                        <div class="float-left">
                            <label for="lang_modal" class="main-label">Language Modal</label>
                            <br><small class="admin-info">Show language modal when user access the site. </small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="lang_modal" value="off" />
                            <input type="checkbox" name="lang_modal" id="chck-lang_modal" value="on" <?php echo ($pt->config->lang_modal == 'on') ? 'checked': '';?>>
                            <label for="chck-lang_modal" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <label for="language">Default Language</label>
                        <br><small class="admin-info">Choose thhe site default language.</small>
                        <div class="form-group">
                            <select class="form-control show-tick" id="language" name="language">
                              <option value="">-- Please select --</option>
                            <?php 
                            $langs__footer = $pt->langs;
                            $langs_html    = '';
                            foreach ($langs__footer as $key => $language) {
                                $lang_explode = explode('.', $language);
                                $language     = $lang_explode[0];
                                $language_    = ucfirst($language);
                                $selected = ($pt->config->language == $language) ? 'selected': '';
                                $langs_html .= '<option value="' . $language . '" ' . $selected . '>' . $language_ . '</option>';
                            }
                            echo $langs_html;
                            ?>
                            </select>
                        </div>
                        <hr>
                        <div class="float-left">
                            <label for="report_copyright" class="main-label">Report Copyright</label>
                            <br><small class="admin-info">Allow users to create copyright takedown requests.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="report_copyright" value="off" />
                            <input type="checkbox" name="report_copyright" id="chck-report_copyright" value="on" <?php echo ($pt->config->report_copyright == 'on') ? 'checked': '';?>>
                            <label for="chck-report_copyright" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        
                        
                        <div class="float-left">
                            <label for="playlist_subscribe" class="main-label">Playlist Subscription</label>
                            <br><small class="admin-info">Allow users to subscribe to playlists</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="playlist_subscribe" value="off" />
                            <input type="checkbox" name="playlist_subscribe" id="chck-playlist_subscribe" value="on" <?php echo ($pt->config->playlist_subscribe == 'on') ? 'checked': '';?>>
                            <label for="chck-playlist_subscribe" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                       
                        <div class="float-left">
                            <label for="post_system" class="main-label">Create Post System</label>
                            <br><small class="admin-info">Allow users to create post under channel page.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="post_system" value="off" />
                            <input type="checkbox" name="post_system" id="chck-post_system" value="on" <?php echo ($pt->config->post_system == 'on') ? 'checked': '';?>>
                            <label for="chck-post_system" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group">
                            <style type="text/css">
                                div .show-menu-arrow .open{overflow: unset !important;}
                            </style>
                            <label class="" for="geo_blocking">{{LANG fav_category}}</label>
                            <div class="">
                                <div class="form-group-rs" id="geo_blocking">
                                <select class="form-control js-example-basic-single" id="multi_select_info" multiple name="fav_category[]" data-live-search="true" title="{{LANG fav_category}}" data-actions-box="true">
                                    <?php 
                                    foreach ($pt->categories as $key => $name): 
                                    if($key != 'other'){
                                        ?>
                                        <option value="<?php echo($key); ?>" <?php if (in_array($key, $pt->config->fav_category)) {echo "selected";} ?>>
                                            <span>
                                                <?php echo($name); ?>
                                            </span>
                                        </option>
                                    <?php } ?>
                                    <?php endforeach; ?>
                                </select>
                                <small class="help-block" style="">{{LANG choose_which_categories}}</small>
                                <div class="clear"></div>
                                </div>
                            </div>
                        </div>
                          <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Video Pagination Limit</label>
                                <input type="number" name="videos_load_limit" class="form-control" value="<?php echo ($pt->config->videos_load_limit);?>" min="2" max="10000">
                                <small class="admin-info">Choose the limit of how many videos will show on each page.</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                         
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Censored Words</label>
                                <input type="text" name="censored_words" class="form-control" value="<?php echo ($pt->config->censored_words);?>">
                                <small class="admin-info">Set censored words, seperated by a comma (,)</small>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            
        </div>
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Login & Registration</h6>
                    <div class="user-settings-alert"></div>
                    <form class="user-settings" method="POST">
                        <div class="float-left">
                            <label for="user_registration" class="main-label">User Registration</label>
                            <br><small class="admin-info">Allow users to create accounts in your site.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="user_registration" value="off" />
                            <input type="checkbox" name="user_registration" id="chck-user_registration" value="on" <?php echo ($pt->config->user_registration == 'on') ? 'checked': '';?>>
                            <label for="chck-user_registration" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="validation" class="main-label">Account Validation</label>
                            <br><small class="admin-info">Send an activation link after registration.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="validation" value="off" />
                            <input type="checkbox" name="validation" id="chck-validation" value="on" <?php echo ($pt->config->validation == 'on') ? 'checked': '';?>>
                            <label for="chck-validation" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="two_factor_setting" class="main-label">Two-Factor Settings</label>
                            <br><small class="admin-info">Send confirmation code to email or SMS when user login.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="two_factor_setting" value="off" />
                            <input type="checkbox" name="two_factor_setting" id="chck-two_factor_setting" value="on" <?php echo ($pt->config->two_factor_setting == 'on') ? 'checked': '';?>>
                            <label for="chck-two_factor_setting" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>

                        <hr>
                        <div class="float-left">
                            <label for="recaptcha" class="main-label">Recaptcha</label>
                            <br><small class="admin-info">Enable reCaptcha to prevent spam.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="recaptcha" value="off" />
                            <input type="checkbox" name="recaptcha" id="chck-recaptcha" value="on" <?php echo ($pt->config->recaptcha == 'on') ? 'checked': '';?>>
                            <label for="chck-recaptcha" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Recaptcha Key</label>
                                <input type="text" name="recaptcha_key" class="form-control" value="<?php echo ($pt->config->recaptcha_key);?>">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">User Configuration</h6>
                    <div class="api-settings-alert"></div>
                    <form class="api-settings" method="POST">
                        <div class="float-left">
                            <label for="delete_account" class="main-label">Delete User Account</label>
                            <br><small class="admin-info">Allow users to delete their accounts.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="delete_account" value="off" />
                            <input type="checkbox" name="delete_account" id="chck-delete_account" value="on" <?php echo ($pt->config->delete_account == 'on') ? 'checked': '';?>>
                            <label for="chck-delete_account" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="verification_badge" class="main-label">User Verification Badge</label>
                            <br><small class="admin-info">Adding verification badge to users</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="verification_badge" value="off" />
                            <input type="checkbox" name="verification_badge" id="chck-verification_badge" value="on" <?php echo ($pt->config->verification_badge == 'on') ? 'checked': '';?>>
                            <label for="chck-verification_badge" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                         <div class="float-left">
                            <label for="block_system" class="main-label">User Block System</label>
                            <br><small class="admin-info">Allow users to block each other.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="block_system" value="off" />
                            <input type="checkbox" name="block_system" id="chck-block_system" value="on" <?php echo ($pt->config->block_system == 'on') ? 'checked': '';?>>
                            <label for="chck-block_system" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="payed_subscribers" class="main-label">Paid Subscribers</label>
                            <br><small class="admin-info">Users should pay to subscribe to a channel.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="payed_subscribers" value="off" />
                            <input type="checkbox" name="payed_subscribers" id="chck-payed_subscribers" value="on" <?php echo ($pt->config->payed_subscribers == 'on') ? 'checked': '';?>>
                            <label for="chck-payed_subscribers" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Commission (Leave it 0 if you don't want to get any commissions.)</label>
                                <input type="text" name="admin_com_subscribers" class="form-control" value="<?php echo ($pt->config->admin_com_subscribers);?>" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');">
                                <small class="admin-info">Commission that will be take from paid subscribers</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="donate_system" class="main-label">Donation System</label>
                            <br><small class="admin-info">Allow users to donate to channels. </small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="donate_system" value="off" />
                            <input type="checkbox" name="donate_system" id="chck-donate_system" value="on" <?php echo ($pt->config->donate_system == 'on') ? 'checked': '';?>>
                            <label for="chck-donate_system" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        
                    </form>
                </div>
            </div>
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Other Settings</h6>
                    <div class="server-settings-alert"></div>
                    <form class="server-settings" method="POST">
                        <label for="server">Messaging & Notifications Server</label>
                        <br><small class="admin-info"><a href="https://docs.playtubescript.com/faqs.html#a-sdfsdf5" target="_blank">Choose which server to use, NodeJS or Ajax. See How to run and install Nodejs/forever/npm on your server?</a></small>
                        <div class="form-group">
                            <select class="form-control show-tick" id="server" name="server">
                              <option value="nodejs" <?php echo ($pt->config->server == 'nodejs') ? 'selected': '';?>>WebSockets</option>
                              <option value="ajax" <?php echo ($pt->config->server == 'ajax') ? 'selected': '';?>>AJAX</option>
                            </select>
                        </div>
                        <hr>
                        <label for="comment_system">Comment System</label>
                        <br><small class="admin-info">Choose the comment system default provider.</small>
                        <div class="form-group">
                            <select class="form-control show-tick" id="comment_system" name="comment_system">
                              <option value="both" <?php echo ($pt->config->comment_system == 'both') ? 'selected': '';?>>Both</option>
                              <option value="default" <?php echo ($pt->config->comment_system == 'default') ? 'selected': '';?>>AJAX (PlayTube)</option>
                              <option value="fb" <?php echo ($pt->config->comment_system == 'fb') ? 'selected': '';?>>FaceBook</option>
                            </select>
                        </div>
                        <label for="comments_default_num">Default Showen Comments</label>
                        <br><small class="admin-info">How many comments to show by default? </small>
                        <div class="form-group">
                            <select class="form-control show-tick" id="comments_default_num" name="comments_default_num">
                              <option value="10" <?php echo ($pt->config->comments_default_num == '10') ? 'selected': '';?>>10</option>
                              <option value="20" <?php echo ($pt->config->comments_default_num == '20') ? 'selected': '';?>>20</option>
                              <option value="30" <?php echo ($pt->config->comments_default_num == '30') ? 'selected': '';?>>30</option>
                              <option value="40" <?php echo ($pt->config->comments_default_num == '40') ? 'selected': '';?>>40</option>
                              <option value="50" <?php echo ($pt->config->comments_default_num == '50') ? 'selected': '';?>>50</option>
                            </select>
                        </div>
                    </form>
                </div>
            </div>
            
        </div>
    </div>
</div>

<script>
$(function() {
    $('.js-example-basic-single').select2({
        placeholder: 'Select',
        dir: $('body').hasClass('rtl') ? 'rtl' : ''
    });
    $('.switcher input[type=checkbox]').click(function () {
        var configName = $(this).attr('name');
        var hash_id = $('input[name=hash_id]').val();
        var objData = {};
        if ($(this).is(":checked") === true) {
            objData[configName] = $(this).val();
        }
        else{
            if ($('input[name='+configName+']')[0]) {
                objData[configName] = $($('input[name='+configName+']')[0]).val();
            }
        }
        objData['hash_id'] = hash_id;
        $.post('{{LINK aj/ap/save-settings}}', objData);
    });

    var setTimeOutColor = setTimeout(function (){});
    $('select').on('change', function() {
         clearTimeout(setTimeOutColor);
        var thisElement = $(this);
        var configName = thisElement.attr('name');
        var hash_id = $('input[name=hash_id]').val();
        var objData = {};
        objData[configName] = thisElement.val();
        objData['hash_id'] = hash_id;
        thisElement.addClass('warning');
        $.post("{{LINK aj/ap/save-settings}}", objData, function (data) {
            if (data.status == 200) {
                thisElement.removeClass('warning');
                thisElement.addClass('success');
            } else {
                thisElement.addClass('error');
            }
            var setTimeOutColor = setTimeout(function () {
                thisElement.removeClass('success');
                thisElement.removeClass('warning');
                thisElement.removeClass('error');
            }, 2000);
        });
    });
    $('input[type=text], input[type=number]').on('keyup', delay(function() {
            clearTimeout(setTimeOutColor);
            var thisElement = $(this);
            var configName = thisElement.attr('name');
            var hash_id = $('input[name=hash_id]').val();
            var objData = {};
            objData[configName] = this.value;
            objData['hash_id'] = hash_id;
            thisElement.addClass('warning');
            $.post("{{LINK aj/ap/save-settings}}", objData, function (data) {
                if (data.status == 200) {
                    thisElement.removeClass('warning');
                    thisElement.addClass('success');
                } else {
                    thisElement.addClass('error');
                }
                var setTimeOutColor = setTimeout(function () {
                    thisElement.removeClass('success');
                    thisElement.removeClass('warning');
                    thisElement.removeClass('error');
                }, 2000);
                //thisElement.focus();
            });
    }, 500));
});

$(function() {
    $('#upload_system_type').change(function(event) {
        if ($(this).val() == 1) {
            $('#p_f_users_').removeClass('hidden');
            $('#all_users_').addClass('hidden');
        }
        else{
            $('#all_users_').removeClass('hidden');
            $('#p_f_users_').addClass('hidden');
        }
    });
    var form_videos_settings = $('form.video-settings');
    
    var form_user_settings = $('form.user-settings');
    var form_comment_settings = $('form.comment-settings');
    var form_api_settings = $('form.api-settings');
    
    var server_settings = $('form.server-settings');
    
    
    var payed_settings = $('form.payed-settings');
    

    payed_settings.ajaxForm({
        url: '{{LINK aj/ap/save-settings}}',
        beforeSend: function() {
            payed_settings.find('button').text("{{LANG please_wait}}");
        },
        success: function(data) {
            if (data.status == 200) {
                payed_settings.find('button').text('Save');
                $('.payed-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                setTimeout(function () {
                    $('.payed-settings-alert').empty();
                }, 2000);
            }
        }
    });


    
   


    

    

    server_settings.ajaxForm({
        url: '{{LINK aj/ap/save-settings}}',
        beforeSend: function() {
            server_settings.find('.waves-effect').text("{{LANG please_wait}}");
        },
        success: function(data) {
            if (data.status == 200) {
                server_settings.find('.waves-effect').text('Save');
                $('.server-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                setTimeout(function () {
                    $('.server-settings-alert').empty();
                }, 2000);
            }
        }
    });

    form_videos_settings.ajaxForm({
        url: '{{LINK aj/ap/save-settings}}',
        beforeSend: function() {
            form_videos_settings.find('.waves-effect').text("{{LANG please_wait}}");
        },
        success: function(data) {
            scrollToTop();
            if (data.status == 200) {
            	form_videos_settings.find('.waves-effect').text('Save');
            	$('.video-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
            	setTimeout(function () {
            		$('.video-settings-alert').empty();
            	}, 2000);
            }
            else{
                form_videos_settings.find('.waves-effect').text('Save');
                $('.video-settings-alert').html('<div class="alert alert-danger"><i class="fa fa-check"></i> Settings updated successfully</div>');
                setTimeout(function () {
                    $('.video-settings-alert').empty();
                }, 2000);
            }
        }
    });

    form_user_settings.ajaxForm({
        url: '{{LINK aj/ap/save-settings}}',
        beforeSend: function() {
            form_user_settings.find('button').text("{{LANG please_wait}}");
        },
        success: function(data) {
            if (data.status == 200) {
                form_user_settings.find('button').text('Save');
                $('.user-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                setTimeout(function () {
                    $('.user-settings-alert').empty();
                }, 2000);
            }
        }
    });

    form_api_settings.ajaxForm({
        url: '{{LINK aj/ap/save-settings}}',
        beforeSend: function() {
            form_api_settings.find('button').text("{{LANG please_wait}}");
        },
        success: function(data) {
            if (data.status == 200) {
                form_api_settings.find('button').text('Save');
                $('.api-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                setTimeout(function () {
                    $('.api-settings-alert').empty();
                }, 2000);
            }
        }
    });

    form_comment_settings.ajaxForm({
        url: '{{LINK aj/ap/save-settings}}',
        beforeSend: function() {
            form_comment_settings.find('.waves-effect').text("{{LANG please_wait}}");
        },
        success: function(data) {
            if (data.status == 200) {
                form_comment_settings.find('.waves-effect').text('Save');
                $('.comment-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                setTimeout(function () {
                    $('.comment-settings-alert').empty();
                }, 2000);
            }
        }
    });
    
});
</script>