plugins/SpecialAdmin.php
changeset 30 7e8fd44b36b0
parent 27 dd659f6ba891
child 36 425261984266
equal deleted inserted replaced
29:e5484a9e0818 30:7e8fd44b36b0
   245     <!-- Global options -->
   245     <!-- Global options -->
   246     
   246     
   247       <tr><th colspan="2">Global site options</th></tr>
   247       <tr><th colspan="2">Global site options</th></tr>
   248       <tr><th colspan="2" class="subhead">These options control the entire site.</th></tr>
   248       <tr><th colspan="2" class="subhead">These options control the entire site.</th></tr>
   249       
   249       
   250       <tr><td class="row1" style="width: 50%;">Site name:</td>                      <td class="row1" style="width: 50%;"><input name="site_name" size="30" value="<?php echo getConfig('site_name'); ?>" /></td></tr>
   250       <tr><td class="row1" style="width: 50%;">Site name:</td>                      <td class="row1" style="width: 50%;"><input type="text" name="site_name" size="30" value="<?php echo getConfig('site_name'); ?>" /></td></tr>
   251       <tr><td class="row2">Site description:</td>               <td class="row2"><input name="site_desc" size="30" value="<?php echo getConfig('site_desc'); ?>" /></td></tr>
   251       <tr><td class="row2">Site description:</td>               <td class="row2"><input type="text" name="site_desc" size="30" value="<?php echo getConfig('site_desc'); ?>" /></td></tr>
   252       <tr><td class="row1">Main page:</td>                      <td class="row1"><?php echo $template->pagename_field('main_page', str_replace('_', ' ', getConfig('main_page'))); ?></td></tr>
   252       <tr><td class="row1">Main page:</td>                      <td class="row1"><?php echo $template->pagename_field('main_page', str_replace('_', ' ', getConfig('main_page'))); ?></td></tr>
   253       <tr><td class="row2">Copyright notice shown on pages:</td><td class="row2"><input name="copyright" size="30" value="<?php echo getConfig('copyright_notice'); ?>" /></td></tr>
   253       <tr><td class="row2">Copyright notice shown on pages:</td><td class="row2"><input type="text" name="copyright" size="30" value="<?php echo getConfig('copyright_notice'); ?>" /></td></tr>
   254       <tr><td class="row1" colspan="2">Hint: If you're using Windows, you can make a "&copy;" symbol by holding ALT and pressing 0169 on the numeric keypad.</td></tr>
   254       <tr><td class="row1" colspan="2">Hint: If you're using Windows, you can make a "&copy;" symbol by holding ALT and pressing 0169 on the numeric keypad.</td></tr>
   255       <tr><td class="row2">Contact e-mail<br /><small>All e-mail sent from this site will appear to have come from the address shown here.</small></td><td class="row2"><input name="contact_email" type="text" size="40" value="<?php echo htmlspecialchars(getConfig('contact_email')); ?>" /></td></tr>
   255       <tr><td class="row2">Contact e-mail<br /><small>All e-mail sent from this site will appear to have come from the address shown here.</small></td><td class="row2"><input name="contact_email" type="text" size="40" value="<?php echo htmlspecialchars(getConfig('contact_email')); ?>" /></td></tr>
   256       
   256       
   257     <!-- Wiki mode -->
   257     <!-- Wiki mode -->
   258       
   258       
   346         <td class="row3" rowspan="2">Disabling the site allows you to work on the site without letting non-administrators see or use it.</td>
   346         <td class="row3" rowspan="2">Disabling the site allows you to work on the site without letting non-administrators see or use it.</td>
   347         <td class="row1"><label><input onclick="if(this.checked) document.getElementById('site_disabled_notice').style.display='block'; else document.getElementById('site_disabled_notice').style.display='none';" type="checkbox" name="site_disabled" <?php if(getConfig('site_disabled') == '1') echo 'checked="checked" '; ?>/>  Disable this site</label></td>
   347         <td class="row1"><label><input onclick="if(this.checked) document.getElementById('site_disabled_notice').style.display='block'; else document.getElementById('site_disabled_notice').style.display='none';" type="checkbox" name="site_disabled" <?php if(getConfig('site_disabled') == '1') echo 'checked="checked" '; ?>/>  Disable this site</label></td>
   348       </tr>
   348       </tr>
   349       <tr>
   349       <tr>
   350         <td class="row2">
   350         <td class="row2">
   351           <div id="site_disabled_notice">
   351           <div id="site_disabled_notice"<?php if(getConfig('site_disabled')!='1') echo(' style="display:none"'); ?>>
   352             Message to show to users:<br />
   352             Message to show to users:<br />
   353             <textarea name="site_disabled_notice" rows="7" cols="30"><?php echo getConfig('site_disabled_notice'); ?></textarea>
   353             <textarea name="site_disabled_notice" rows="7" cols="30"><?php echo getConfig('site_disabled_notice'); ?></textarea>
   354           </div>
   354           </div>
   355         </td>
   355         </td>
   356       </tr>
   356       </tr>
   956         if(!$e) echo '<div class="error-box">Error during row deletion: '.mysql_error().'</div>';
   956         if(!$e) echo '<div class="error-box">Error during row deletion: '.mysql_error().'</div>';
   957         else echo '<div class="info-box">All activation requests for the user "'.$_GET['user'].'" have been deleted.</div>';
   957         else echo '<div class="info-box">All activation requests for the user "'.$_GET['user'].'" have been deleted.</div>';
   958         break;
   958         break;
   959     }
   959     }
   960   }
   960   }
   961   $q = $db->sql_query('SELECT log_type, action, time_id, date_string, author, edit_summary FROM '.table_prefix.'logs WHERE log_type=\'admin\' AND action=\'activ_req\' ORDER BY time_id DESC;');
   961   $q = $db->sql_query('SELECT l.log_type, l.action, l.time_id, l.date_string, l.author, l.edit_summary, u.user_coppa FROM '.table_prefix.'logs AS l
       
   962                          LEFT JOIN '.table_prefix.'users AS u
       
   963                            ON ( u.username = l.edit_summary OR u.username IS NULL )
       
   964                          WHERE log_type=\'admin\' AND action=\'activ_req\' ORDER BY time_id DESC;');
   962   if($q)
   965   if($q)
   963   {
   966   {
   964     if($db->numrows() > 0)
   967     if($db->numrows() > 0)
   965     {
   968     {
   966       $n = $db->numrows();
   969       $n = $db->numrows();
   967       if($n == 1) $s = $n . ' user is';
   970       if($n == 1) $s = $n . ' user is';
   968       else $s = $n . ' users are';
   971       else $s = $n . ' users are';
   969       echo '<h3>'.$s . ' awaiting account activation</h3>';
   972       echo '<h3>'.$s . ' awaiting account activation</h3>';
   970       echo '<div class="tblholder">
   973       echo '<div class="tblholder">
   971             <table border="0" cellspacing="1" cellpadding="4" width="100%">
   974             <table border="0" cellspacing="1" cellpadding="4" width="100%">
   972             <tr><th>Date of request</th><th>Requested by</th><th>Requested for</th><th colspan="3">Actions</th></tr>';
   975             <tr><th>Date of request</th><th>Requested by</th><th>Requested for</th><th>COPPA user</th><th colspan="3">Actions</th></tr>';
   973       $cls = 'row2';
   976       $cls = 'row2';
   974       while($row = $db->fetchrow())
   977       while($row = $db->fetchrow())
   975       {
   978       {
   976         if($cls == 'row2') $cls = 'row1';
   979         if($cls == 'row2') $cls = 'row1';
   977         else $cls = 'row2';
   980         else $cls = 'row2';
   978         echo '<tr><td class="'.$cls.'">'.date('F d, Y h:i a', $row['time_id']).'</td><td class="'.$cls.'">'.$row['author'].'</td><td class="'.$cls.'">'.$row['edit_summary'].'</td><td class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'UserManager&amp;action=activate&amp;user='.$row['edit_summary'].'&amp;logid='.$row['time_id']).'">Activate now</a></td><td class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'UserManager&amp;action=sendemail&amp;user='.$row['edit_summary'].'&amp;logid='.$row['time_id']).'">Send activation e-mail</a></td><td class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'UserManager&amp;action=deny&amp;user='.$row['edit_summary'].'&amp;logid='.$row['time_id']).'">Deny request</a></td></tr>';
   981         $coppa = ( $row['user_coppa'] == '1' ) ? '<b>Yes</b>' : 'No';
       
   982         echo '<tr><td class="'.$cls.'">'.date('F d, Y h:i a', $row['time_id']).'</td><td class="'.$cls.'">'.$row['author'].'</td><td class="'.$cls.'">'.$row['edit_summary'].'</td><td style="text-align: center;" class="' . $cls . '">' . $coppa . '</td><td class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'UserManager&amp;action=activate&amp;user='.$row['edit_summary'].'&amp;logid='.$row['time_id']).'">Activate now</a></td><td class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'UserManager&amp;action=sendemail&amp;user='.$row['edit_summary'].'&amp;logid='.$row['time_id']).'">Send activation e-mail</a></td><td class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'UserManager&amp;action=deny&amp;user='.$row['edit_summary'].'&amp;logid='.$row['time_id']).'">Deny request</a></td></tr>';
   979       }
   983       }
   980       echo '</table>';
   984       echo '</table>';
   981     }
   985     }
   982     $db->free_result();
   986     $db->free_result();
   983   }
   987   }
  1338   echo '<tr><td class="row2">Group name:</td><td class="row2"><input type="text" name="create_group_name" /></td></tr>';
  1342   echo '<tr><td class="row2">Group name:</td><td class="row2"><input type="text" name="create_group_name" /></td></tr>';
  1339   echo '<tr><td colspan="2" class="row1" style="text-align: center;"><input type="submit" name="do_create_stage1" value="Continue >" /></td></tr>
  1343   echo '<tr><td colspan="2" class="row1" style="text-align: center;"><input type="submit" name="do_create_stage1" value="Continue >" /></td></tr>
  1340         </table>
  1344         </table>
  1341         </div>';
  1345         </div>';
  1342   echo '</form>';
  1346   echo '</form>';
       
  1347 }
       
  1348 
       
  1349 function page_Admin_COPPA()
       
  1350 {
       
  1351   global $db, $session, $paths, $template, $plugins; // Common objects
       
  1352   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
       
  1353   {
       
  1354     echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
       
  1355     return;
       
  1356   }
       
  1357   
       
  1358   echo '<h2>Background information</h2>';
       
  1359   echo '<p>
       
  1360           The United States Childrens\' Online Privacy Protection Act (COPPA) was a law passed in 2001 that requires sites oriented towards
       
  1361           children under 13 years old or with a significant amount of under-13 children clearly state what information is being collected
       
  1362           in a privacy policy and obtain authorization from a parent or legal guardian before allowing children to use the site. Enano 
       
  1363           provides an easy way to allow you, as the website administrator, to obtain this authorization.
       
  1364         </p>';
       
  1365   
       
  1366   // Start form
       
  1367   
       
  1368   if ( isset($_POST['coppa_address']) )
       
  1369   {
       
  1370     // Saving changes
       
  1371     $enable_coppa = ( isset($_POST['enable_coppa']) ) ? '1' : '0';
       
  1372     setConfig('enable_coppa', $enable_coppa);
       
  1373     
       
  1374     $address = $_POST['coppa_address']; // RenderMan::preprocess_text($_POST['coppa_address'], true, false);
       
  1375     setConfig('coppa_address', $address);
       
  1376     
       
  1377     echo '<div class="info-box">Your changes have been saved.</div>';
       
  1378   }
       
  1379   
       
  1380   echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', (( isset($_GET['sqldbg'])) ? 'sqldbg&amp;' : '') .'module='.$paths->cpage['module']).'" method="post">';
       
  1381   
       
  1382   echo '<div class="tblholder">';
       
  1383   echo '<table border="0" cellspacing="1" cellpadding="4">';
       
  1384   echo '<tr>
       
  1385           <th colspan="2">
       
  1386             COPPA support
       
  1387           </th>
       
  1388         </tr>';
       
  1389         
       
  1390   echo '<tr>
       
  1391           <td class="row1">
       
  1392             Enable COPPA support:
       
  1393           </td>
       
  1394           <td class="row2">
       
  1395             <label><input type="checkbox" name="enable_coppa" ' . ( ( getConfig('enable_coppa') == '1' ) ? 'checked="checked"' : '' ) . ' /> COPPA enabled</label><br />
       
  1396             <small>If this is checked, users will be asked if they are under 13 years of age before registering</small>
       
  1397           </td>
       
  1398         </tr>';
       
  1399         
       
  1400   echo '<tr>
       
  1401           <td class="row1">
       
  1402             Your mailing address:<br />
       
  1403             <small>This is the address to which parents will send authorization forms.</small>
       
  1404           </td>
       
  1405           <td class="row2">
       
  1406             <textarea name="coppa_address" rows="7" cols="40">' . getConfig('coppa_address') . '</textarea>
       
  1407           </td>
       
  1408         </tr>';
       
  1409         
       
  1410   echo '<tr>
       
  1411           <th colspan="2" class="subhead">
       
  1412             <input type="submit" value="Save changes" />
       
  1413           </th>
       
  1414         </tr>';
       
  1415         
       
  1416   echo '</table>';
       
  1417   
       
  1418   echo '</form>';
       
  1419   
  1343 }
  1420 }
  1344 
  1421 
  1345 function page_Admin_PageManager()
  1422 function page_Admin_PageManager()
  1346 {
  1423 {
  1347   global $db, $session, $paths, $template, $plugins; // Common objects
  1424   global $db, $session, $paths, $template, $plugins; // Common objects