<?php 
$selected_age_yes = ($wo['config']['age'] == 1) ? ' selected' : '';
$selected_age_no  = ($wo['config']['age'] == 0) ? ' selected' : '';
$selected_user_second_post_button_yes   = ($wo['config']['second_post_button'] == 'wonder')   ? ' selected' : '';
$selected_user_second_post_button_no    = ($wo['config']['second_post_button'] == 'dislike')   ? ' selected' : '';
$selected_reCaptcha_yes   = ($wo['config']['reCaptcha'] == 1)   ? ' checked' : '';
$selected_reCaptcha_no   = ($wo['config']['reCaptcha'] == 0)   ? ' checked' : '';
?>
<div class="list-group">
   <div class="list-group-item"><i class="fa fa-fw fa-wrench"></i> <?php echo $wo['lang']['site_setting']; ?></div>
   <div class="setting-well page-margin">
      <form action="" method="post" class="admin-site-setting form-horizontal">
         <div class="form-group">
            <label class="col-md-3" for="siteName"><?php echo $wo['lang']['site_name']; ?> </label>  
            <div class="col-md-6">
               <input type="text" class="form-control" name="siteName" value="<?php echo $wo['config']['siteName'];?>">
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="siteTitle"><?php echo $wo['lang']['site_title']; ?></label>  
            <div class="col-md-6">
               <input type="text" class="form-control" name="siteTitle" value="<?php echo $wo['config']['siteTitle'];?>"> 
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="siteKeywords"><?php echo $wo['lang']['site_keywords']; ?></label>  
            <div class="col-md-6">
               <input type="text" class="form-control" name="siteKeywords" value="<?php echo $wo['config']['siteKeywords'];?>">
               <span class="help-block"><?php echo $wo['lang']['site_keywords_help']; ?></span>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="siteDesc"><?php echo $wo['lang']['site_description']; ?></label>  
            <div class="col-md-6">
               <textarea name="siteDesc" class="form-control" cols="10" rows="3"><?php echo $wo['config']['siteDesc'];?></textarea>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="siteEmail"><?php echo $wo['lang']['site_email']; ?></label>  
            <div class="col-md-6">
               <input type="text" class="form-control" name="siteEmail" value="<?php echo $wo['config']['siteEmail'];?>">
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="defualtLang"><?php echo $wo['lang']['site_lang']; ?></label>  
            <div class="col-md-6">
               <select name="defualtLang" class="form-control">
                  <?php
                     foreach (Wo_GetLanguages() as $lang) {
                        
                       $languages = str_replace(".php","",$lang);
                        
                       $languages_name = ucfirst(strtolower($languages));
                        
                       $selected_lang = ($languages == $wo['config']['defualtLang']) ? ' selected' : '';
                        
                     ?>
                  <option value="<?php echo $languages;?>"<?php echo $selected_lang;?> ><?php echo $languages_name;?></option>
                  <?php } ?>
               </select>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" ><?php echo $wo['lang']['second_button_type']; ?></label>  
            <div class="col-md-6">
               <select name="second_post_button" class="form-control">
                  <option value="wonder" <?php echo $selected_user_second_post_button_yes;?> ><?php echo $wo['lang']['wonder']; ?></option>
                  <option value="dislike" <?php echo $selected_user_second_post_button_no;?> ><?php echo $wo['lang']['dislike']; ?></option>
               </select>
            </div>
         </div>
         <hr>
         <div class="form-group">
            <label class="col-md-3" for="connectivitySystem"><?php echo $wo['lang']['connectivity_system']; ?></label>  
            <div class="col-md-6">
               <select name="connectivitySystem" class="form-control">
                  <option value="1" <?php echo ($wo['config']['connectivitySystem'] == 1) ? ' selected': '';?>><?php echo $wo['lang']['friends_system']; ?></option>
                  <option value="0" <?php echo ($wo['config']['connectivitySystem'] == 0) ? ' selected': '';?>><?php echo $wo['lang']['follow_system']; ?></option>
               </select>
               <span class="help-block"><?php echo $wo['lang']['connectivity_system_note'];?></span>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3"><?php echo $wo['lang']['display_user_age_as']; ?></label>  
            <div class="col-md-6">
               <select name="age" class="form-control">
                  <option value="1" <?php echo $selected_age_yes;?> ><?php echo $wo['lang']['date']; ?></option>
                  <option value="0" <?php echo $selected_age_no;?> ><?php echo $wo['lang']['age']; ?></option>
               </select>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="maxUpload"><?php echo $wo['lang']['max_upload_size']; ?></label>  
            <div class="col-md-6">
               <select name="maxUpload" class="form-control">
                  <option value="2000000"    <?php echo ($wo['config']['maxUpload'] == 2000000)   ? ' selected': '';?>>2 MB</option>
                  <option value="6000000"    <?php echo ($wo['config']['maxUpload'] == 6000000)   ? ' selected': '';?>>6 MB</option>
                  <option value="12000000"   <?php echo ($wo['config']['maxUpload'] == 12000000)  ? ' selected': '';?>>12 MB</option>
                  <option value="24000000"   <?php echo ($wo['config']['maxUpload'] == 24000000)  ? ' selected': '';?>>24 MB</option>
                  <option value="48000000"   <?php echo ($wo['config']['maxUpload'] == 48000000)  ? ' selected': '';?>>48 MB</option>
                  <option value="96000000"   <?php echo ($wo['config']['maxUpload'] == 96000000)  ? ' selected': '';?>>96 MB</option>
                  <option value="256000000"  <?php echo ($wo['config']['maxUpload'] == 256000000) ? ' selected': '';?>>256 MB</option>
                  <option value="512000000"  <?php echo ($wo['config']['maxUpload'] == 512000000) ? ' selected': '';?>>512 MB</option>
                  <option value="1000000000" <?php echo ($wo['config']['maxUpload'] == 1000000000) ? ' selected': '';?>>1 GB</option>
               </select>
               <span class="help-block">Server max uplaod size = <?php echo Wo_SizeFormat(Wo_MaxFileUpload()); ?></span>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="maxCharacters"><?php echo $wo['lang']['max_characters_length']; ?></label>  
            <div class="col-md-6">
               <select name="maxCharacters" class="form-control">
                  <option value="80"   <?php echo ($wo['config']['maxCharacters'] == 80) ? ' selected': '';?>>80 Characters</option>
                  <option value="160"  <?php echo ($wo['config']['maxCharacters'] == 160) ? ' selected': '';?>>160 Characters</option>
                  <option value="320"  <?php echo ($wo['config']['maxCharacters'] == 320) ? ' selected': '';?>>320 Characters</option>
                  <option value="640"  <?php echo ($wo['config']['maxCharacters'] == 640) ? ' selected': '';?>>640 Characters</option>
                  <option value="1280" <?php echo ($wo['config']['maxCharacters'] == 1280) ? ' selected': '';?>>1280 Characters</option>
                  <option value="5000" <?php echo ($wo['config']['maxCharacters'] == 5000) ? ' selected': '';?>>5000 Characters</option>
                  <option value="10000" <?php echo ($wo['config']['maxCharacters'] == 10000) ? ' selected': '';?>>Unlimited</option>
               </select>
               <span class="help-block">Posts/messages max characters</span>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="allowedExtenstion"><?php echo $wo['lang']['allowed_extenstions']; ?></label>  
            <div class="col-md-6">
               <input type="text" class="form-control" name="allowedExtenstion" value="<?php echo $wo['config']['allowedExtenstion'];?>">
               <span class="help-block"><?php echo $wo['lang']['file_sharing_extenstions'];?></span>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="censored_words">Censored Words</label>  
            <div class="col-md-6">
               <input type="text" class="form-control" name="censored_words" value="<?php echo $wo['config']['censored_words'];?>">
               <span class="help-block"><?php echo $wo['lang']['word_cons'];?></span>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="google_map_api">Google Map API</label>  
            <div class="col-md-6">
               <input type="text" class="form-control" name="google_map_api" value="<?php echo $wo['config']['google_map_api'];?>">
            </div>
         </div>
         <hr>
         <div class="form-group">
            <label class="col-md-3" for="reCaptcha"><?php echo $wo['lang']['reCaptcha']; ?></label>
            <div class="col-md-5"> 
               <label class="radio-inline" for="reCaptcha-0">
               <input type="radio" name="reCaptcha" id="reCaptcha-0" value="1" <?php echo $selected_reCaptcha_yes; ?>>
               <?php echo $wo['lang']['enable']; ?>
               </label> 
               <label class="radio-inline" for="reCaptcha-1">
               <input type="radio" name="reCaptcha" id="reCaptcha-1" value="0" <?php echo $selected_reCaptcha_no; ?>>
               <?php echo $wo['lang']['disable']; ?>
               </label>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3" for="reCaptchaKey"><?php echo $wo['lang']['reCaptcha_key']; ?></label>  
            <div class="col-md-6">
               <input type="text" class="form-control" name="reCaptchaKey" value="<?php echo $wo['config']['reCaptchaKey'];?>">
            </div>
         </div>
         <hr>
         <div class="form-group">
            <label class="col-md-3" for="googleAnalytics"><?php echo $wo['lang']['google_analytics_code']; ?></label>  
            <div class="col-md-6">
               <textarea name="googleAnalytics" class="form-control" cols="10" rows="3"><?php echo $wo['config']['googleAnalytics'];?></textarea>
            </div>
         </div>
         <div class="form-group">
            <label class="col-md-3"></label>  
            <div class="col-md-6">
               <button type="submit" class="btn btn-main">
               <i class="fa fa-floppy-o progress-icon" data-icon="floppy-o"></i>  <?php echo $wo['lang']['save']?>
               </button>   
            </div>
         </div>
      </form>
   </div>
</div>
<script type="text/javascript">
$(function() {
    $('form.admin-site-setting').ajaxForm({
      url: Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_site_setting',
      beforeSend: function() {
        Wo_progressIconLoader($('form.admin-site-setting').find('button'));
      },
      success: function(data) {
        if (data.status == 200) {
          $('form.admin-site-setting button').html('<i class="fa fa-check"></i> <?php echo $wo["lang"]["saved"];?>');
          setTimeout(function () {
            $('form.admin-site-setting button').html('<i class="fa fa-floppy-o progress-icon" data-icon="floppy-o"></i>  <?php echo $wo["lang"]["save"]?>');
          }, 2000);
          
          Wo_progressIconLoader($('form.admin-site-setting').find('button'));

        } 
      }
    });
});
</script>