Esempio n. 1
0
<?php

/**
 * Delete a plugin and remove it from all locations.
 */
// save typing below
$typef_app_dir = Typeframe::CurrentPage()->applicationUri();
// requires POST
if ('POST' != $_SERVER['REQUEST_METHOD']) {
    Typeframe::Redirect('Nothing to do.', $typef_app_dir);
    return;
}
// get and validate plugin id
$plugid = trim(@$_POST['plugid']);
$plug = Model_Plug::Get($plugid);
if (!$plug->exists()) {
    Typeframe::Redirect('Invalid plugin id.', $typef_app_dir);
    return;
}
// delete any locations that use this plugin
$plug_locs = new Model_PlugLoc();
$plug_locs->where('plugid = ?', $plugid);
foreach ($plug_locs->getAll() as $plug_loc) {
    $plug_loc->delete();
}
// delete the plugin itself
$plug->delete();
// done
Typeframe::Redirect('Plugin deleted.', "{$typef_app_dir}?skin={$_POST['skin']}");
Esempio n. 2
0
File: index.php Progetto: ssrsfs/blg
$pm->setVariable('skins', $skins);
// set skin; add to template
$skin = trim(@$_REQUEST['skin']);
$skin = strlen($skin) > 0 ? $_REQUEST['skin'] : (TYPEF_SITE_SKIN ? TYPEF_SITE_SKIN : 'default');
if (!in_array($skin, $skins)) {
    Typeframe::Redirect("'{$skin}' was not found in the skins directory.", TYPEF_WEB_DIR . '/admin/skins');
    return;
}
$pm->setVariable('skin', $skin);
// load sockets
$plugins = array();
$sockets = new Model_PlugLoc();
$sockets->where('skin = ?', $skin);
$sockets->where('plugin.siteid = ?', Typeframe::CurrentPage()->siteid());
$sockets->order('socket, sortnum');
foreach ($sockets->getAll() as $socket) {
    if (!isset($plugins[$socket->get('socket')])) {
        $plugins[$socket->get('socket')] = array();
    }
    $plugins[$socket->get('socket')][] = $socket;
}
// define skin file
$skinfile = TYPEF_DIR . '/skins/' . $skin . '/skin.html';
if (!file_exists($skinfile)) {
    $skinfile = TYPEF_DIR . '/skins/default/skin.html';
}
// load sockets for skin file
$source = file_get_contents($skinfile);
foreach (get_html_translation_table() as $character => $entity) {
    if ($entity != '&amp;' && $entity != '&quot;' && $entity != '&gt;' && $entity != '&lt;') {
        $source = str_replace($entity, ' ', $source);