Remove old TinyMCE from include directory.
Remove old TinyMCE from include directory.

File last commit:

dc98d7eb2bb1
42817e39f376
Show More
manage-metatypes.php
106 lines | 3.3 KiB | text/x-php | PhpLexer
/ manage-metatypes.php
Add most necessary files for admin interface.
r1 <?php
require_once('include/admin.inc.php');
auth_redirect(); // Require logged in user to access this page.
if( isset($_GET['delete']) && (int)$_GET['delete'] ) {
check_nonce('delete-metatype-'.(int)$_GET['delete']);
if(! $mtdb->query( 'DELETE FROM meta_t WHERE id=' . (int)$_GET['delete'] ) )
{
adminlog("Error on deleting metatype ".(int)$_GET['delete'], MTS_TYPE_META, MTA_DELETE, E_WARNING);
Switch to mysqli_* in other php files.
r5 mtdie("Error on update: ". htmlentities(mysqli_error()));
Add most necessary files for admin interface.
r1 }
$info.='<p>Deleted metatype successfully.<p>';
adminlog("Metatype ".(int)$_GET['delete']." deleted.", MTS_TYPE_META, MTA_DELETE);
}
if( isset($_POST['action']) && $_POST['action'] == 'new_meta' ) {
check_nonce('new-metatype');
Switch to mysqli_* in other php files.
r5
Add most necessary files for admin interface.
r1 $name = trim($_POST['name']);
Switch to mysqli_* in other php files.
r5
Add most necessary files for admin interface.
r1 if( check_type_name( $name ) ) {
Switch to mysqli_* in other php files.
r5 if(! $mtdb->query( 'INSERT INTO meta_t(name) VALUES("'. mysqli_real_escape_string($mtdb->link, $name) . '")' ) )
Add most necessary files for admin interface.
r1 {
adminlog("Error on inserting metatype ".(int)$_GET['delete'], MTS_TYPE_META, MTA_INSERT, E_WARNING);
Switch to mysqli_* in other php files.
r5 mtdie("Error on insertion: ". htmlentities(mysqli_error()));
Add most necessary files for admin interface.
r1 }
}
$info.='<p>New metatype created successfully.<p>';
adminlog("Metatype ".$name." added.", MTS_TYPE_META, MTA_ADD);
}
if( isset($_POST['action']) && $_POST['action'] == 'edit_meta' ) {
check_nonce('save-metatype-'.(int)$_POST['type_id']);
Switch to mysqli_* in other php files.
r5
Add most necessary files for admin interface.
r1 $name = trim($_POST['name']);
Switch to mysqli_* in other php files.
r5
Add most necessary files for admin interface.
r1 if( check_type_name( $name ) ) {
Switch to mysqli_* in other php files.
r5 if(! $mtdb->query( 'UPDATE meta_t SET name = "' . mysqli_real_escape_string($mtdb->link, $name) . '" WHERE id=' . (int)$_POST['type_id']) )
Add most necessary files for admin interface.
r1 {
adminlog("Error updating metatype ".(int)$_GET['delete'], MTS_TYPE_META, MTA_UPDATE, E_WARNING);
Switch to mysqli_* in other php files.
r5 mtdie("Error on update: ". htmlentities(mysqli_error()));
Add most necessary files for admin interface.
r1 }
}
$info.='<p>Changes to metatype saved successfully.<p>';
adminlog("Metatype ".$name." updated.", MTS_TYPE_META, MTA_UPDATE);
}
//get all metatypes
$metas = $mtdb->getAll("SELECT id, name FROM meta_t");
adminhead('Metatypes');
adminmenu();
?>
<h2>Metatype Management</h2>
<p>Make changes to the metatypes which organize the types.</p>
<table class="widefat">
<thead>
<tr>
<th scope="col" style="text-align: center;">Metatype #</th>
<th scope="col">Name</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody id="the-list">
<?php
$alternate=false;
foreach( $metas as $s ) {
$alternate=!$alternate;
?>
<tr id="type-<?php echo $s->id; ?>" <?php if($alternate) echo 'class="alternate"'; ?>>
<th scope="row" style="text-align: center;"><?php echo $s->id; ?></th>
<td><?php echo htmlentities($s->name); ?></td>
<td style="text-align: center;"><a href="edit-metatype.php?edit=<?php echo (int)$s->id; ?>">Edit</a></td>
<td style="text-align: center;"><a class="delete" href="?delete=<?php echo (int)$s->id; ?>">Delete</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<form enctype="multipart/form-data" name="create-user" id="create-user" action="manage-metatypes.php" method="post">
<?php nonce_field('new-metatype'); ?>
<input type="hidden" name="action" value="new_meta" />
<h2>Create New Metatype</h2>
<div class="narrow">
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th scope="row" width="33%">Name</th>
<td width="66%"><input name="name" type="text" id="name" value="" /></td>
</tr>
</table>
Switch to mysqli_* in other php files.
r5
Add most necessary files for admin interface.
r1 <p class="submit"><input type="submit" value="Create &raquo;" name="submit" /></p>
</div>
</form>
<?php
adminfooter();
Switch to mysqli_* in other php files.
r5 ?>