yms/admincp.php
author Dan Fuhry <dan@enanocms.org>
Mon, 24 Nov 2014 15:11:44 -0500
changeset 8 be4a5f24bb29
parent 7 3db638306413
permissions -rw-r--r--
Add support for freezing the YMS client ID
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
     1
<?php
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
     2
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
     3
$plugins->attachHook('session_started', "yms_add_admincp();");
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
     4
 
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
     5
function yms_add_admincp()
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
     6
{
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
     7
  global $paths;
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
     8
 
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
     9
  $paths->addAdminNode('adm_cat_appearance', 'yms_acp_title', 'YMS', scriptPath . '/plugins/yms/icons/admincp.png');
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    10
}
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    11
 
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    12
function page_Admin_YMS()
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    13
{
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    14
  // Security check
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    15
  global $session;
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    16
  if ( $session->auth_level < USER_LEVEL_ADMIN )
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    17
    return false;
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    18
  
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    19
  global $lang;
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    20
  
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    21
  if ( isset($_POST['submit']) )
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    22
  {
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    23
    setConfig('yms_require_reauth', isset($_POST['require_reauth']) ? '1' : '0');
8
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    24
    setConfig('yms_force_client_id', !empty($_POST['force_client_id']) && ctype_digit($_POST['force_client_id']) ? $_POST['force_client_id'] : '');
4
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    25
    setConfig('yms_claim_enable', isset($_POST['claim_enable']) ? '1' : '0');
3
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    26
    setConfig('yms_claim_auth_enable', isset($_POST['claimauth_enable']) ? '1' : '0');
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    27
    setConfig('yms_claim_auth_field', $_POST['claimauth_field']);
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    28
    setConfig('yms_claim_auth_url', $_POST['claimauth_url']);
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    29
    setConfig('yms_claim_auth_key', $_POST['claimauth_key']);
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    30
    
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    31
    echo '<div class="info-box">' . $lang->get('yms_acp_msg_saved') . '</div>';
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    32
  }
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    33
 
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    34
  acp_start_form();
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    35
  ?>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    36
  <h3><?php echo $lang->get('yms_acp_heading_main'); ?></h3>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    37
  
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    38
  <div class="tblholder">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    39
  <table border="0" cellspacing="1" cellpadding="4">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    40
  
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    41
    <tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    42
      <th colspan="2"><?php echo $lang->get('yms_acp_th_main'); ?></th>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    43
    </tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    44
    
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    45
    <tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    46
      <td class="row2" style="width: 50%;">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    47
        <?php echo $lang->get('yms_acp_field_require_reauth_title'); ?><br />
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    48
        <small><?php echo $lang->get('yms_acp_field_require_reauth_hint'); ?></small>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    49
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    50
      <td class="row1" style="width: 50%;">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    51
        <label>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    52
          <input type="checkbox" name="require_reauth" <?php if ( getConfig('yms_require_reauth', 1) == 1 ) echo 'checked="checked" '; ?>/>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    53
          <?php echo $lang->get('yms_acp_field_require_reauth'); ?>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    54
        </label>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    55
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    56
    </tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    57
    
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    58
    <tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    59
      <td class="row2" style="width: 50%;">
8
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    60
        <?php echo $lang->get('yms_acp_field_force_client_id_title'); ?><br />
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    61
        <small><?php echo $lang->get('yms_acp_field_force_client_id_hint'); ?></small>
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    62
      </td>
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    63
      <td class="row1" style="width: 50%;">
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    64
        <input type="text" size="5" name="force_client_id" <?php if ( ($force_cid = getConfig('yms_force_client_id', 0)) > 0 ) echo 'value="' . $force_cid . '"'; ?>/>
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    65
      </td>
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    66
    </tr>
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    67
    
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    68
    <tr>
be4a5f24bb29 Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents: 7
diff changeset
    69
      <td class="row2" style="width: 50%;">
4
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    70
        <?php echo $lang->get('yms_acp_field_claim_enable_title'); ?><br />
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    71
        <small><?php echo $lang->get('yms_acp_field_claim_enable_hint'); ?></small>
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    72
      </td>
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    73
      <td class="row1" style="width: 50%;">
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    74
        <label>
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    75
          <input type="checkbox" name="claim_enable" <?php if ( getConfig('yms_claim_enable', 0) == 1 ) echo 'checked="checked" '; ?>/>
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    76
          <?php echo $lang->get('yms_acp_field_claim_enable'); ?>
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    77
        </label>
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    78
      </td>
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    79
    </tr>
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    80
    
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    81
    <tr>
9fdc988ce46e Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents: 3
diff changeset
    82
      <td class="row2" style="width: 50%;">
3
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    83
        <?php echo $lang->get('yms_acp_field_claimauth_enable_title'); ?><br />
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    84
        <small><?php echo $lang->get('yms_acp_field_claimauth_enable_hint'); ?></small>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    85
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    86
      <td class="row1" style="width: 50%;">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    87
        <label>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    88
          <input type="checkbox" name="claimauth_enable" <?php if ( getConfig('yms_claim_auth_enable', 1) == 1 ) echo 'checked="checked" '; ?>/>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    89
          <?php echo $lang->get('yms_acp_field_claimauth_enable'); ?>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    90
        </label>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    91
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    92
    </tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    93
    
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    94
    <tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    95
      <td class="row2" style="width: 50%;">
7
3db638306413 Fixed claimauth strings
Dan Fuhry <dan@enanocms.org>
parents: 4
diff changeset
    96
        <?php echo $lang->get('yms_acp_field_claimauth_title'); ?><br />
3db638306413 Fixed claimauth strings
Dan Fuhry <dan@enanocms.org>
parents: 4
diff changeset
    97
        <small><?php echo $lang->get('yms_acp_field_claimauth_title_hint'); ?></small>
3
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    98
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
    99
      <td class="row1" style="width: 50%;">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   100
        <input type="text" name="claimauth_field" value="<?php echo htmlspecialchars(getConfig('yms_claim_auth_field', '')); ?>" size="40" />
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   101
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   102
    </tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   103
    
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   104
    <tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   105
      <td class="row2" style="width: 50%;">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   106
        <?php echo $lang->get('yms_acp_field_claimauth_url_title'); ?><br />
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   107
        <small><?php echo $lang->get('yms_acp_field_claimauth_url_hint'); ?></small>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   108
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   109
      <td class="row1" style="width: 50%;">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   110
        <input type="text" name="claimauth_url" value="<?php echo htmlspecialchars(getConfig('yms_claim_auth_url', '')); ?>" size="40" />
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   111
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   112
    </tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   113
    
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   114
    <tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   115
      <td class="row2" style="width: 50%;">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   116
        <?php echo $lang->get('yms_acp_field_claimauth_key_title'); ?><br />
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   117
        <small><?php echo $lang->get('yms_acp_field_claimauth_key_hint'); ?></small>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   118
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   119
      <td class="row1" style="width: 50%;">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   120
        <input type="text" name="claimauth_key" value="<?php echo htmlspecialchars(getConfig('yms_claim_auth_key', '')); ?>" size="40" />
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   121
      </td>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   122
    </tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   123
    
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   124
    <tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   125
      <th colspan="2" class="subhead">
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   126
        <input name="submit" type="submit" value="<?php echo $lang->get('etc_save_changes'); ?>" />
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   127
      </th>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   128
    </tr>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   129
  
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   130
  </table>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   131
  </div>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   132
  
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   133
  </form>
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   134
  <?php
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   135
}
6edb31919f0e Added admin CP. Basic feature set is finished!
Dan
parents:
diff changeset
   136