Ejemplo n.º 1
0
if (isset($_POST['delete'])) {
    if (isset($_POST['confirmpwd']) && futurebb_hash($_POST['confirmpwd']) == $futurebb_user['password']) {
        $id = intval($_POST['delete_id']);
        $q = new DBSelect('pages', array('*'), 'id=' . $id, 'Failed to get page to delete');
        $result = $q->commit();
        if (!$db->num_rows($result)) {
            httperror(404);
        }
        $page = $db->fetch_assoc($result);
        $lines = array();
        foreach ($page as $key => $val) {
            $lines[] = $key . '=>' . $val;
        }
        $q = new DBInsert('interface_history', array('action' => 'delete', 'area' => 'pages', 'field' => intval($id), 'user' => $futurebb_user['id'], 'time' => time(), 'old_value' => base64_encode(implode("\n", $lines))), 'Failed to insert history entry');
        $q->commit();
        $q = new DBDelete('pages', 'id=' . $id, 'Failed to delete page entry');
        $q->commit();
        CacheEngine::CachePages();
    } else {
        $_GET['delete'] = $_POST['delete_id'];
    }
}
if (isset($_GET['delete'])) {
    $id = intval($_GET['delete']);
    $q = new DBSelect('pages', array('*'), 'id=' . $id, 'Failed to get page to delete');
    $result = $q->commit();
    if (!$db->num_rows($result)) {
        httperror(404);
    }
    $page = $db->fetch_assoc($result);
    ?>
Ejemplo n.º 2
0
 static function remove_language_key($key, $language = 'English')
 {
     global $db;
     $q = new DBDelete('language', 'language=\'' . $db->escape($language) . '\' AND langkey=\'' . $db->escape($key) . '\'', 'Failed to delete langauge key');
     $q->commit();
     //clear the cache
     $maindir = FORUM_ROOT . '/app_config/cache/language/' . $language;
     if (file_exists($maindir) && is_dir($maindir)) {
         $handle = opendir($maindir);
         while ($file = readdir($handle)) {
             if ($file != '.' && $file != '..') {
                 unlink($maindir . '/' . $file);
             }
         }
     }
 }