<?php
  /**
   * Configuration
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2017
   * @version $Id: configuration.tpl.php, v1.00 2017-02-05 10:12:05 gewa Exp $
   */
  if (!defined("_WOJO"))
      die('Direct access to this location is not allowed.');
	  
  if (!Auth::checkAcl("owner")) : print Message::msgError(Lang::$word->NOACCESS); return; endif;
?>
<div class="row horizontal-gutters align-middle">
  <div class="columns">
    <h2><?php echo Lang::$word->META_M_SETTINGS;?></h2>
    <p class="wojo small text"><?php echo Lang::$word->CONF_INFO;?></p>
  </div>
  <div class="columns shrink"><a data-action="toggle" data-page="setting" class="wojo small primary icon label sAction"><i class="icon question sign"></i></a>
  </div>
</div>
<form method="post" id="wojo_form" name="wojo_form">
  <div class="wojo segment form">
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_SITE;?>
          <i class="icon asterisk"></i></label>
        <div class="wojo input">
          <input type="text" placeholder="<?php echo Lang::$word->CONF_SITE;?>" value="<?php echo $this->core->site_name;?>" name="site_name">
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_COMPANY;?>
          <i class="icon asterisk"></i></label>
        <div class="wojo input">
          <input type="text" placeholder="<?php echo Lang::$word->CONF_COMPANY;?>" value="<?php echo $this->core->company;?>" name="company">
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_DIR;?></label>
        <div class="wojo input">
          <input type="text" placeholder="<?php echo Lang::$word->CONF_DIR;?>" value="<?php echo $this->core->site_dir;?>" name="site_dir">
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_EMAIL;?>
          <i class="icon asterisk"></i></label>
        <div class="wojo input">
          <input type="text" placeholder="<?php echo Lang::$word->CONF_EMAIL;?>" value="<?php echo $this->core->site_email;?>" name="site_email">
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_LOGO;?>
        </label>
        <input type="file" name="logo" id="logo" class="filefield">
        <div class="wojo half-top-padding">
          <div class="wojo checkbox small checkbox">
            <input name="dellogo" type="checkbox" value="1">
            <label><?php echo Lang::$word->CONF_DELLOGO;?></label>
          </div>
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_LOGOP;?>
        </label>
        <input type="file" name="plogo" id="plogo" class="filefield">
        <div class="wojo half-top-padding">
          <div class="wojo checkbox small checkbox">
            <input name="dellogop" type="checkbox" value="1">
            <label><?php echo Lang::$word->CONF_DELLOGO;?></label>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo double fitted basic divider"></div>
    <div class="wojo space divider"></div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_LONGDATE;?>
          <i class="icon asterisk"></i></label>
        <select name="long_date" class="wojo fluid dropdown">
          <?php echo Date::getLongDate($this->core->long_date);?>
        </select>
      </div>
      <div class="field three wide">
        <label><?php echo Lang::$word->CONF_SHORTDATE;?>
          <i class="icon asterisk"></i></label>
        <select name="short_date" class="wojo fluid dropdown">
          <?php echo Date::getShortDate($this->core->short_date);?>
        </select>
      </div>
      <div class="field two wide">
        <label><?php echo Lang::$word->CONF_TIMEFORMAT;?>
          <i class="icon asterisk"></i></label>
        <select name="time_format" class="wojo fluid dropdown">
          <?php echo Date::getTimeFormat($this->core->time_format);?>
        </select>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_WEEKSTART;?></label>
        <select name="weekstart" class="wojo fluid dropdown">
          <?php echo Date::weekList(true, true, $this->core->weekstart);?>
        </select>
      </div>
      <div class="field three wide">
        <label><?php echo Lang::$word->CONF_LANG;?></label>
        <select name="lang" class="wojo fluid dropdown">
          <?php foreach(Lang::fetchLanguage() as $langlist):?>
          <option value="<?php echo substr($langlist, 0, 2);?>" <?php echo Validator::getSelected($this->core->lang, substr($langlist, 0, 2));?>><?php echo strtoupper(substr($langlist, 0, 2));?></option>
          <?php endforeach;?>
        </select>
      </div>
      <div class="field two wide">
        <label><?php echo Lang::$word->CONF_PERPAGE;?>
          <i class="icon asterisk"></i></label>
        <input type="text" placeholder="<?php echo Lang::$word->CONF_PERPAGE;?>" value="<?php echo $this->core->perpage;?>" name="perpage">
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_DTZ;?></label>
        <select name="dtz" class="wojo fluid dropdown">
          <?php echo Date::getTimezones();?>
        </select>
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_LOCALES;?></label>
        <select name="locale" class="wojo fluid dropdown">
          <?php echo Date::localeList($this->core->locale);?>
        </select>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->CONF_THEME;?></label>
        <div class="row half-horizontal-gutters align-middle">
          <div class="columns">
            <select name="theme" class="wojo fluid dropdown">
              <?php File::getThemes(FRONTBASE . "/themes", $this->core->theme);?>
            </select>
          </div>
          <div class="columns shrink">
            <div class="wojo basic small icon top left pointing dropdown button">
              <i class="icon contrast"></i>
              <div class="menu small">
                <div class="item" data-value="_default.css"><?php echo Lang::$word->DEFAULT;?></div>
                <?php if($this->colors):?>
                <?php foreach($this->colors as $key => $color):?>
                <div class="item" data-value="<?php echo $key;?>"><?php echo $color;?></div>
                <?php endforeach;?>
                <?php endif;?>
              </div>
              <input name="color" type="hidden" value="<?php echo $this->core->color;?>">
            </div>
          </div>
        </div>
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_PLOADER;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="ploader" type="radio" value="1" <?php Validator::getChecked($this->core->ploader, 1); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="ploader" type="radio" value="0" <?php Validator::getChecked($this->core->ploader, 0); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_EUCOOKIE;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="eucookie" type="radio" value="1" <?php Validator::getChecked($this->core->eucookie, 1); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="eucookie" type="radio" value="0" <?php Validator::getChecked($this->core->eucookie, 0); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->CONF_LOGIN_ATTEMPT;?></label>
        <input data-range='{"step":1,"from":0, "to":6, "scale":[0,2,4,6]}' type="hidden" name="attempt" value="<?php echo $this->core->attempt;?>" class="rangeslider">
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_LOGIN_TIME;?></label>
        <input data-range='{"step":5,"from":5, "to":90, "format":"%s min", "scale":[5,20,50,75,100]}' type="hidden" name="flood" value="<?php echo ($this->core->flood / 60);?>" class="rangeslider">
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_LOG_ON;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="logging" type="radio" value="1" <?php Validator::getChecked($this->core->logging, 1); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="logging" type="radio" value="0" <?php Validator::getChecked($this->core->logging, 0); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo space divider"></div>
    <div class="wojo double fitted basic divider"></div>
    <div class="wojo space divider"></div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->CONF_REGVERIFY;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="reg_verify" type="radio" value="1" <?php Validator::getChecked($this->core->reg_verify, 1); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="reg_verify" type="radio" value="0" <?php Validator::getChecked($this->core->reg_verify, 0); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_AUTOVERIFY;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="auto_verify" type="radio" value="1" <?php Validator::getChecked($this->core->auto_verify, 1); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="auto_verify" type="radio" value="0" <?php Validator::getChecked($this->core->auto_verify, 0); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_NOTIFY_ADMIN;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="notify_admin" type="radio" value="1" <?php Validator::getChecked($this->core->notify_admin, 1); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="notify_admin" type="radio" value="0" <?php Validator::getChecked($this->core->notify_admin, 0); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->CONF_CURRENCY;?></label>
        <input type="text" placeholder="<?php echo Lang::$word->CONF_CURRENCY;?>" value="<?php echo $this->core->currency;?>" name="currency">
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_ETAX;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="enable_tax" type="radio" value="1" <?php Validator::getChecked($this->core->enable_tax, 1); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="enable_tax" type="radio" value="0" <?php Validator::getChecked($this->core->enable_tax, 0); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_HLAYOUT;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="home_layout" type="radio" value="1" <?php Validator::getChecked($this->core->home_layout, 1); ?>>
            <label><?php echo Lang::$word->GRID;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="home_layout" type="radio" value="0" <?php Validator::getChecked($this->core->home_layout, 0); ?>>
            <label><?php echo Lang::$word->LIST;?></label>
          </div>
        </div>
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_COMMENTS;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="enable_comments" type="radio" value="1" <?php Validator::getChecked($this->core->enable_comments, 1); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="enable_comments" type="radio" value="0" <?php Validator::getChecked($this->core->enable_comments, 0); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->CONF_FILEDIR;?>
          <i class="icon asterisk"></i></label>
        <input type="text" placeholder="<?php echo Lang::$word->CONF_FILEDIR;?>" value="<?php echo $this->core->file_dir;?>" name="file_dir">
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_FREEDOWN;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="allow_free" type="radio" value="yes" <?php Validator::getChecked($this->core->allow_free, "yes"); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="allow_free" type="radio" value="no" <?php Validator::getChecked($this->core->allow_free, "no"); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->CONF_CPERPAGE;?></label>
        <input data-range='{"step":2,"from":6, "to":40, "format":"%s items", "scale":[6,12,16,32,40]}' type="hidden" name="cperpage" value="<?php echo $this->core->cperpage;?>" class="rangeslider">
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_FEATURED;?></label>
        <input data-range='{"step":2,"from":2, "to":20, "format":"%s items", "scale":[2,6,12,16,20]}' type="hidden" name="featured" value="<?php echo $this->core->featured;?>" class="rangeslider">
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_TH_WH;?>
          <i class="icon asterisk"></i></label>
        <div class="row horizontal-gutters">
          <div class="column">
            <input data-range='{"step":50,"from":150, "to":400, "format":"%s px", "scale":[150,200,250,300,400]}' type="hidden" name="thumb_w" value="<?php echo $this->core->thumb_w;?>" class="rangeslider">
          </div>
          <div class="column">
            <input data-range='{"step":50,"from":150, "to":400, "format":"%s px", "scale":[150,200,250,300,400]}' type="hidden" name="thumb_h" value="<?php echo $this->core->thumb_h;?>" class="rangeslider">
          </div>
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_AV_WH;?>
          <i class="icon asterisk"></i></label>
        <div class="row horizontal-gutters">
          <div class="column">
            <input data-range='{"step":50,"from":150, "to":400, "format":"%s px", "scale":[150,200,250,300,400]}' type="hidden" name="avatar_w" value="<?php echo $this->core->avatar_w;?>" class="rangeslider">
          </div>
          <div class="column">
            <input data-range='{"step":50,"from":150, "to":400, "format":"%s px", "scale":[150,200,250,300,400]}' type="hidden" name="avatar_h" value="<?php echo $this->core->avatar_h;?>" class="rangeslider">
          </div>
        </div>
      </div>
    </div>
    <div class="wojo space divider"></div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_TWID;?></label>
        <div class="wojo icon input">
          <input type="text" placeholder="<?php echo Lang::$word->CONF_TWID;?>" value="<?php echo $this->core->social->twitter;?>" name="twitter">
          <i class="icon twitter"></i>
        </div>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_FBID;?></label>
        <div class="wojo icon input">
          <input type="text" placeholder="<?php echo Lang::$word->CONF_FBID;?>" value="<?php echo $this->core->social->facebook;?>" name="facebook">
          <i class="icon facebook"></i>
        </div>
      </div>
    </div>
    <div class="wojo double fitted basic divider"></div>
    <div class="wojo space divider"></div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_INVDATA;?></label>
        <textarea class="altpost" name="inv_info"><?php echo $this->core->inv_info;?></textarea>
      </div>
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_INVNOTE;?></label>
        <textarea class="altpost" name="inv_note"><?php echo $this->core->inv_note;?></textarea>
      </div>
    </div>
    <div class="wojo double fitted divider"></div>
    <div class="wojo fields">
      <div class="five wide field">
        <label><?php echo Lang::$word->CONF_OFFLINE_M;?></label>
        <div class="wojo inline fields">
          <div class="wojo checkbox radio field">
            <input name="offline" type="radio" value="1" <?php Validator::getChecked($this->core->offline, 1); ?>>
            <label><?php echo Lang::$word->YES;?></label>
          </div>
          <div class="wojo checkbox radio field">
            <input name="offline" type="radio" value="0" <?php Validator::getChecked($this->core->offline, 0); ?>>
            <label><?php echo Lang::$word->NO;?></label>
          </div>
        </div>
      </div>
      <div class="five wide field">
        <label><?php echo Lang::$word->CONF_OFFLINE_DT;?></label>
        <div class="row">
          <div class="column">
            <div class="wojo fluid calendar left icon joint start input" data-datepicker="true">
              <input name="offline_d" type="text" placeholder="<?php echo Lang::$word->CONF_OFFLINE_DT;?>" value="<?php echo $this->core->offline_d;?>" readonly>
              <i class="icon date"></i>
            </div>
          </div>
          <div class="column">
            <div class="wojo fluid calendar left icon joint end input" data-timepicker="true">
              <input name="offline_t" type="text" placeholder="<?php echo Lang::$word->CONF_OFFLINE_DT;?>" value="<?php echo $this->core->offline_t;?>" readonly>
              <i class="icon clock"></i>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field">
        <label><?php echo Lang::$word->CONF_OFFLINE_MS;?></label>
        <textarea class="altpost" name="offline_msg"><?php echo $this->core->offline_msg;?></textarea>
      </div>
    </div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_GA;?></label>
        <textarea name="analytics"><?php echo $this->core->analytics;?></textarea>
      </div>
      <div class="field">
        <label><?php echo Lang::$word->CONF_GMAPKEY;?>
          <i class="icon asterisk"></i></label>
        <input type="text" placeholder="<?php echo Lang::$word->CONF_GMAPKEY;?>" value="<?php echo $this->core->mapapi;?>" name="mapapi">
      </div>
    </div>
    <div class="wojo double fitted basic divider"></div>
    <div class="wojo space divider"></div>
    <div class="wojo fields">
      <div class="field five wide">
        <label><?php echo Lang::$word->CONF_MAILER;?></label>
        <select name="mailer" id="mailerchange" class="wojo fluid dropdown">
          <option value="PHP" <?php echo Validator::getSelected($this->core->mailer, "PHP");?>>PHP Mailer</option>
          <option value="SMAIL" <?php echo Validator::getSelected($this->core->mailer, "SMAIL");?>>Sendmail</option>
          <option value="SMTP" <?php echo Validator::getSelected($this->core->mailer, "SMTP");?>>SMTP Mailer</option>
        </select>
      </div>
      <div class="field showsmail">
        <label><?php echo Lang::$word->CONF_SMAILPATH;?></label>
        <input type="text" placeholder="<?php echo Lang::$word->CONF_SMAILPATH;?>" value="<?php echo $this->core->sendmail;?>" name="sendmail">
      </div>
    </div>
    <div class="showsmtp">
      <div class="wojo fields">
        <div class="field five wide">
          <label><?php echo Lang::$word->CONF_SMTP_HOST;?>
            <i class="icon asterisk"></i></label>
          <input type="text" placeholder="<?php echo Lang::$word->CONF_SMTP_HOST;?>" value="<?php echo $this->core->smtp_host;?>" name="smtp_host">
        </div>
        <div class="field five wide">
          <label><?php echo Lang::$word->CONF_SMTP_USER;?></label>
          <input type="text" placeholder="<?php echo Lang::$word->CONF_SMTP_USER;?>" value="<?php echo $this->core->smtp_user;?>" name="smtp_user">
        </div>
      </div>
      <div class="wojo fields">
        <div class="field three wide">
          <label><?php echo Lang::$word->CONF_SMTP_PASS;?></label>
          <input type="text" placeholder="<?php echo Lang::$word->CONF_SMTP_PASS;?>" value="<?php echo $this->core->smtp_pass;?>" name="smtp_pass">
        </div>
        <div class="field three wide">
          <label><?php echo Lang::$word->CONF_SMTP_PORT;?></label>
          <input type="text" placeholder="<?php echo Lang::$word->CONF_SMTP_PORT;?>" value="<?php echo $this->core->smtp_port;?>" name="smtp_port">
        </div>
        <div class="field four wide">
          <label><?php echo Lang::$word->CONF_SMTP_SSL;?></label>
          <div class="wojo inline fields">
            <div class="wojo checkbox radio field">
              <input name="is_ssl" type="radio" value="1" <?php Validator::getChecked($this->core->is_ssl, 1); ?>>
              <label><?php echo Lang::$word->YES;?></label>
            </div>
            <div class="wojo checkbox radio field">
              <input name="is_ssl" type="radio" value="0" <?php Validator::getChecked($this->core->is_ssl, 0); ?>>
              <label><?php echo Lang::$word->NO;?></label>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="content-center">
    <button type="button" data-action="processConfig" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->CONF_UPDATE;?></button>
  </div>
</form>
<script type="text/javascript"> 
// <![CDATA[  
$(document).ready(function () {
     var res2 = '<?php echo $this->core->mailer;?>';
	 $('.showsmtp').velocity(res2 == "SMTP" ? 'slideDown' : 'slideUp');
     $('#mailerchange').change(function () {
         var res = $("#mailerchange option:selected").val();
		 $('.showsmtp').velocity(res == "SMTP" ? 'slideDown' : 'slideUp');
     });

	 $('.showsmail').velocity(res2 == "SMAIL" ? 'slideDown' : 'slideUp');
     $('#mailerchange').change(function () {
         var res = $("#mailerchange option:selected").val();
		 $('.showsmail').velocity(res == "SMAIL" ? 'slideDown' : 'slideUp');
     });
});
// ]]>
</script>