#administration-page
  .page-header
    %h2
      %li.icon-bug
      = t("Debug")
  
      %a.pull-right(href="#{Yii::app()->createUrl('debug/DisableDebug')}" title="#{t('Leave Debug Mode')}")
        .icon-signout
        
  %span8
    %form(method="POST" action="#{url('debug/console')}")
      %label(for="fast_command")='Fast Command: '
      %input(id="fast_command" name="command" type="text" style="width: 80%;")
      %input(type="submit")
  
  %span8
    %form(method="POST" action="#{url('debug/query')}")
      %label(for="fast_query")='Fast Query: '
      %input(id="fast_query" name="query" type="text" style="width: 80%;")
      %input(type="submit")
  
  %span8
    %table
      %tr
        %td
          .span3
            .admin-menu-container.span3
              .admin-menu-title
                =t("GUI Management")
              %section
                %span.title
                  ='HOST: '.getDbHost()
              %section
                %span.title
                  ='DB: '.getDbName()
              %section
                %span.title
                  ='USER: '.getDbUser()
              %section
                %span.title
                  ='URL: '.paramdeep('photoBaseUrl')." (".(paramdeep('photoBaseLocationByUrl')?'true':'false').")"
                  %br
                  ='PATH: '.paramdeep('photoBasePath')
              %section
                %span.title
                  %a(href="#{url('debug/runtime_config')}")
                    = Yii::t("app", "Runtime configuration")
              %section
                %span.title
                  %a(href="#{url('debug/loggers')}")
                    = Yii::t("app", "Loggers")
              %section
                %span.title
                  %a(href="#{url('debug/dynconfig')}")
                    = Yii::t("app", "Debug configuration")                  
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/cleanRuntime')}" onclick="return confirm('#{t('Confirm operation?')}');")
                    = t('Clean runtime')
                    - $runtimeSize = DebugController::getRuntimeSize()
                    - if(!empty($runtimeSize))
                      = " ($runtimeSize)"
              %section
                %span.title
                  %a(href="#{url('debug/migrations')}")
                    = Yii::t("app", "Migrations")
              %section
                %span.title
                  %a(href="#{url('debug/translations')}")
                    = Yii::t("app", "Translations")
              - if(user()->checkAccess('plateauthinsertprofile_management'))  
                %section
                  %span.title
                    %a(href="#{Yii::app()->createUrl('PlateAuthInsertProfile/admin')}")
                      = t('Manage Plate Auth Insert Profiles')
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('api/playground')}")
                    = t('API playground')
        %td
          .span3
            .admin-menu-container.span3
              .admin-menu-title
                =t("Remote Administration")
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/fileExplorer')}")
                    = t('File Explorer')
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/console')}")
                    = t('Console')
              -$appLogFilename = pathCombine(app()->basePath, 'runtime/application.log')
              %section
                %span.title(title="#{$appLogFilename}")
                  -if(fileExists($appLogFilename))
                    %a(href="#{Yii::app()->createUrl('debug/viewAsText', array('filename'=>$appLogFilename))}")
                      = t('Application Log')
                  -else
                    = t('Application Log')
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/logs')}")
                    = t('Logs')
              %section
                %span.title
                  -if(DebugHelper::toolExists('schtasks'))
                    %a(href="#{Yii::app()->createUrl('debug/scheduledTasks')}")
                      = t('Scheduled Tasks')
                    %span.color-green=t('Found')
                  -else
                    = t('Scheduled Tasks')
                    %span.color-red=t('Not found')
              %section
                %span.title
                  -if(DebugHelper::toolExists('tasklist'))
                    %a(href="#{Yii::app()->createUrl('debug/processes')}")
                      = t('Processes')
                    %span.color-green=t('Found')
                  -else
                    = t('Processes')
                    %span.color-red=t('Not found')
              %section
                %span.title
                  -if(DebugHelper::toolExists('sc'))
                    %a(href="#{Yii::app()->createUrl('debug/services')}")
                      = t('Services')
                    %span.color-green=t('Found')
                  -else
                    = t('Services')
                    %span.color-red=t('Not found')
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/UserTrackingIndex')}")
                    = t('User Tracking')
                  -if(paramdeep('security','user_tracking','enabled'))
                    .icon-off(style="color: green;")
                  -else
                    .icon-off(style="color: red;")
                  =" (".formatBytes(DebugHelper::getTableSize('user_tracking_table')).")"
              - if($sendExp = paramdeep ( 'security', 'send_export_registration' ))    
                %section
                  %span.title
                    %a(href="#{Yii::app()->createUrl('report/doRegisterAllExportCounters')}")
                      = t('Register export actions')
        %td
          .span3
            .admin-menu-container.span3
              .admin-menu-title
                =t("Test")
              %section
                %span.title
                  %a(href="#{url('debug/test_impersonate')}")
                    =t("Impersonate")
              %section
                %span.title
                  %a(href="#{url('debug/test_createNotification')}")
                    =t("Create Test Notification")
              %section
                %span.title
                  %a(href="#{url('debug/FlashMessages')}")
                    = Yii::t("app", "Flash messages")
        %td
          .span3
            .admin-menu-container.span3
              .admin-menu-title
                =t("Performances")
              %section
                %span.title
                  %a(href="#{url('debug/exportImages')}")
                    =t("Export Images")
                 
      %tr
        %td
          .span3
            .admin-menu-container.span3
              .admin-menu-title
                =t("Models")
              %section
                %span.title
                  %a(href="#{url('gii')}")
                    ="Gii"
              %section
                %span.title
                  %a(href="#{url('debug/model_create')}")
                    =t("Create")
              %section
                %span.title
                  %a(href="#{url('debug/model_edit')}")
                    =t("Edit")
              %section
                %span.title
                  %a(href="#{url('debug/model_createRelation')}")
                    ="Create relation"

        %td
          .span3
            .admin-menu-container.span3
              .admin-menu-title
                =t("PHP")." (".call_func('phpversion', array(), t('Not found')).")"
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/phpinfo')}")
                    = t('PHP Info')
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/eval')}")
                    = t('Evaluate PHP code')
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/phpFunctions')}")
                    = t('Functions')
              %section
                %span.title
                  -$phpIni = DebugHelper::php_getIniPath()
                  -if(fileExists($phpIni))
                    %a(href="#{url('debug/viewAsText',array('filename'=>$phpIni))}")
                      = t('PHP.ini')
                    %span.color-green=t('Found')
                  -else
                    =t('PHP.ini')
                    %span.color-red=t('Not found')
              %section
                %span.title
                  = t('PHP.exe')
                  -$phpExe = DebugHelper::php_getExePath()
                  -if(fileExists($phpExe))
                    %span.color-green=t('Found')
                    %a(href="#{url('debug/fileExplorer',array('path'=>dirname($phpExe)))}")
                      %span.icon-folder-open-alt
                  -else
                    %span.color-red=t('Not found')
              %section
                %span.title
                  %a(href="#{url('debug/PhpExtensions')}")
                    = t('Extensions')
                  -$extPhpPath = DebugHelper::php_getExtensionFolderPath()
                  -if(dirExists($extPhpPath))
                    %span.color-green=t('Found')
                    %a(href="#{url('debug/fileExplorer',array('path'=>$extPhpPath))}")
                      %span.icon-folder-open-alt
                  -else
                    %span.color-red=t('Not found')
        %td
          -$apacheServiceName=DebugHelper::apache_getServiceName()
          -$apachePath=DebugHelper::apache_getPath()
          .span3
            .admin-menu-container.span3
              .admin-menu-title
                =t("Apache")
              %section
                %span.title
                  ="SERVICE:"
                  -if(!isEmpty($apacheServiceName))
                    -if(!isEmpty($apachePath))
                      %a(href="#{url('debug/fileExplorer',array('path'=>$apachePath))}")
                        %span.color-blue=$apacheServiceName
                    -else
                      %span.color-blue=$apacheServiceName
                    %span.color-green=t('Found')
                  -else
                    %span.color-red=t('Not found')
              -if(!isEmpty($apachePath))
                -$conf=DebugHelper::apache_getConfigPath()
                -if(!isEmpty($conf))
                  %section
                    %span.title
                      %a(href="#{url('debug/viewAsText',array('filename'=>$conf))}")
                        = t('Configuration')
              -if(!isEmpty($apacheServiceName))
                %section
                  %span.title
                    %a(href="#{Yii::app()->createUrl('debug/apache_restart')}")
                      = t('Restart')
        %td
          -$mysqlServiceName=DebugHelper::mysql_getServiceName()
          -$mysqlPath=DebugHelper::mysql_getPath()
          .span3
            .admin-menu-container.span3
              .admin-menu-title
                =t("MySQL")
              %section
                %span.title
                  ="SERVICE:"
                  -if(!isEmpty($mysqlServiceName))
                    -if(!isEmpty($mysqlPath))
                      %a(href="#{url('debug/fileExplorer',array('path'=>$mysqlPath))}")
                        %span.color-blue=$mysqlServiceName
                    -else
                      %span.color-blue=$mysqlServiceName
                    %span.color-green=t('Found')
                  -else
                    %span.color-red=t('Not found')
              -if(!isEmpty($mysqlServiceName))
                -if(!isEmpty($mysqlPath))
                  -$conf=DebugHelper::mysql_getConfigPath()
                  -if(!isEmpty($conf))
                    %section
                      %span.title
                        %a(href="#{url('debug/viewAsText',array('filename'=>$conf))}")
                          = t('Configuration')
                %section
                  %span.title
                    %a(href="#{Yii::app()->createUrl('debug/mysql_restart')}")
                      = t('Restart')
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/query')}")
                    = t('Query')
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/DbRepairTable')}")
                    = t('Repair')
              %section
                %span.title
                  %a(href="#{Yii::app()->createUrl('debug/MysqlProcessList')}")
                    = t('Process List')
      %tr
        %td
          .span3
            .admin-menu-container.span3
              .admin-menu-title
                =t("KNowP")
              %section
                %span.title
                  %small
                    %span='ID:'
                    %span.color-blue=KNowPHelper::getInstallationId()
  
  %center.color-blue  
    !="PID: ".call_func('getmypid', array(), "getmypid: ".t('Not found'))
  %center.color-blue  
    !=call_func('php_uname', array(), "php_uname: ".t('Not found'))
  %center.color-blue  
    !=call_func('apache_get_version', array(), "apache_get_version: ".t('Not found'))
  %center.color-blue  
    -if(check_internet_connection("www.google.com",80,2))
      ='CONNECTED to The Internet'
    -else
      ='NOT CONNECTED The Internet'
  %center.color-blue  
    =".NET x86:"
    -foreach(DebugHelper::getDotNetFrameworks(false) as $dot)
      -if($dot->hasCompiler())
        %a(href="#")=$dot
      -else
        =$dot
  %center.color-blue
    =".NET x64:"
    -foreach(DebugHelper::getDotNetFrameworks(true) as $dot)
      -if($dot->hasCompiler())
        %a(href="#")=$dot
      -else
        =$dot
      