<!DOCTYPE html>
<html{if="$language !=='auto'"} lang=" {$language}"{/if}>

  <head>
    {include="includes"}
  </head>

  <body>
    {include="page.header"}

    <section>
      <h2 class="window-title">{'Configure'|t}</h2>
      <form method="POST" action="{$base_path}/admin/configure" name="configform" id="configform">

        <label for="title">Shaarli {'title'|t}</label>
        <input type="text" name="title" id="title" value="{$title}">

        <label for="titleLink">{'Home link'|t}</label>
        <input type="text" name="titleLink" id="titleLink" size="50" value="{$titleLink}">

        <label for="titleLink">{'Themes'|t}</label>
        <select name="theme" id="theme">
          {loop="$theme_available"}
          <option value="{$value}" {if="$value===$theme"} selected="selected" {/if}>
            {$value|ucfirst}
          </option>
          {/loop}
        </select>

        <label for="formatter">{'Description formatter'|t}</label>
        <select name="formatter" id="formatter">
          {loop="$formatter_available"}
          <option value="{$value}" {if="$value===$formatter"} selected="selected" {/if}>
            {$value|ucfirst}
          </option>
          {/loop}
        </select>

        <label for="language">{'Languages'|t}</label>
        <select name="language" id="language">
          {loop="$languages"}
          <option value="{$key}" {if="$key===$language"} selected="selected" {/if}>
            {$value}
          </option>
          {/loop}
        </select>

        <label for="continent">{'Continent'|t}</label>
        <select id="continent" name="continent">
          {loop="$continents"}
          {if="$key !== 'selected'"}
          <option value="{$value}" {if="$continents.selected === $value"}selected{/if}>
            {$value}
          </option>
          {/if}
          {/loop}
        </select>

        <label for="city">{'City'|t}</label>
        <select id="city" name="city">
          {loop="$cities"}
          {if="$key !== 'selected'"}
          <option value="{$value.city}" {if="$cities.selected === $value.city"}selected{/if}
            data-continent="{$value.continent}">
            {$value.city}
          </option>
          {/if}
          {/loop}
        </select>

        <label for="disablesessionprotection">
          <input type="checkbox" name="disablesessionprotection" id="disablesessionprotection"
            {if="$session_protection_disabled"}checked{/if}>
          {'Disable session cookie hijacking protection'|t}
        </label>
        <small>{'Check this if you get disconnected or if your IP address changes often'|t}</small>

        <label for="privateLinkByDefault">
          <input type="checkbox" name="privateLinkByDefault" id="privateLinkByDefault" {if="$private_links_default"}checked{/if}>
          {'Private links by default'|t}
        </label>
        <small>{'All new links are private by default'|t}</small>

        <label for="enableRssPermalinks">
          <input type="checkbox" name="enableRssPermalinks" id="enableRssPermalinks" {if="$enable_rss_permalinks"}checked{/if}>
          {'RSS direct links'|t}
        </label>
        <small>{'Check this to use direct URL instead of permalink in feeds'|t}</small>

        <label for="hidePublicLinks">
          <input type="checkbox" name="hidePublicLinks" id="hidePublicLinks" {if="$hide_public_links"}checked{/if}>
          {'Hide public links'|t}
        </label>
        <small>{'Do not show any links if the user is not logged in'|t}</small>

        <label for="updateCheck">
          <input type="checkbox" name="updateCheck" id="updateCheck" {if="$enable_update_check"}checked{/if}>
          {'Check for updates'|t}
        </label>
        <small>{'Notify me when a new release is ready'|t}</small>

        <label for="retrieveDescription">
          <input type="checkbox" name="retrieveDescription" id="retrieveDescription" {if="$retrieve_description"}checked{/if}>
          {'Automatically retrieve description for new bookmarks'|t}
        </label>
        <small>{'Shaarli will try to retrieve the description from meta HTML headers'|t}</small>

        <label for="enableApi">
          <input type="checkbox" name="enableApi" id="enableApi" {if="$api_enabled"}checked{/if}>
          {'Enable REST API'|t}
        </label>
        <small>{'Allow third party software to use Shaarli such as mobile application'|t}</small>

        <label for="apiSecret">
          {'REST API secret'|t}<br>
        </label>
        <input type="text" name="apiSecret" id="apiSecret" size="50" value="{$api_secret}">

        <label for="enableThumbnails">
          {'Enable thumbnails'|t}<br>
          {if="! $gd_enabled"}
          {'You need to enable the extension <code>php-gd</code> to use thumbnails.'|t}
          {elseif="$thumbnails_enabled"}
          <a href="{$base_path}/admin/thumbnails">{'Synchronize thumbnails'|t}</a>
          {/if}
        </label>

        <select name="enableThumbnails" id="enableThumbnails">
          <option value="all" {if="$thumbnails_mode=='all'"}selected{/if}>
            {'All'|t}
          </option>
          <option value="common" {if="$thumbnails_mode=='common'"}selected{/if}>
            {'Only common media hosts'|t}
          </option>
          <option value="none" {if="$thumbnails_mode=='none'"}selected{/if}>
            {'None'|t}
          </option>
        </select>

        <input type="submit" value="{'Save'|t}" name="save">
        <input type="hidden" name="token" value="{$token}">
      </form>
    </section>

    {include="page.footer"}
  </body>
  </html>