Ejemplo n.º 1
0
<?php

require_once dirname(__FILE__) . '/accesscheck.php';
# convert the database to add the prefix
# dangerous, should not be used, particularly not if the prefix already exists
if (!$GLOBALS["table_prefix"]) {
    print "No prefix defined, nothing to do";
    return;
}
include "structure.php";
while (list($table, $value) = each($DBstruct)) {
    if ($table != $tables[$table]) {
        Sql_Drop_Table($tables[$table]);
        Sql_Verbose_Query("alter table {$table} rename {$tables[$table]}", 0);
    }
}
$req = Sql_Verbose_Query("select tablename from " . $tables["attribute"]);
while ($row = Sql_Fetch_Row($req)) {
    set_time_limit(500);
    if (Sql_Table_Exists("listattr_" . $row[0]) && $table_prefix) {
        Sql_Verbose_Query("alter table listattr_{$row['0']} rename {$table_prefix}" . "listattr_" . $row[0]);
    }
    if (Sql_Table_Exists($table_prefix . "listattr_" . $row[0])) {
        Sql_Query("alter table {$table_prefix}" . "listattr_" . $row[0] . " add column listorder integer default 0", 0);
    }
}
flush();
Ejemplo n.º 2
0
                Sql_Query('insert into ' . $table_prefix . 'adminattr_' . $lc_name . ' (name) values("Unchecked")');
                # we cannot "require" checkboxes, that does not make sense
                Sql_Query("update {$tables['adminattribute']} set required = 0 where id = {$insertid}");
            }
        } elseif (!empty($_POST["name"][$id])) {
            # it is a change
            $query = sprintf('update %s set name = "%s" ,listorder = %d,default_value = "%s" ,required = %d where id = %d', $tables["adminattribute"], sql_escape($_POST["name"][$id]), $_POST["listorder"][$id], sql_escape($_POST["default"][$id]), isset($_POST["required"][$id]), $id);
            Sql_Query($query);
        }
    }
    if (isset($_POST["delete"])) {
        while (list($id, $val) = each($_POST["delete"])) {
            $res = Sql_Query("select tablename,type from {$tables['adminattribute']} where id = {$id}");
            $row = Sql_Fetch_Row($res);
            if ($row[1] != "hidden" && $row[1] != "textline") {
                Sql_Drop_Table($table_prefix . 'adminattr_' . $row[0]);
            }
            Sql_Query("delete from {$tables['adminattribute']} where id = {$id}");
            # delete all admin attributes as well
            Sql_Query("delete from {$tables['admin_attribute']} where adminattributeid = {$id}");
        }
    }
}
?>



<?php 
print formStart(' class="adminattributesListing" ');
$res = Sql_Query("select * from {$tables['adminattribute']} order by listorder");
if (Sql_Num_Rows($res)) {
Ejemplo n.º 3
0
    flush();
}
function flushbuffer()
{
    for ($i = 0; $i < 10000; $i++) {
        print " \n";
    }
    flush();
}
include dirname(__FILE__) . '/structure.php';
set_time_limit(60000);
if (!Sql_Table_exists($GLOBALS['tables']['linktrack_forward']) || !Sql_Table_exists($GLOBALS['tables']['linktrack_ml']) || !Sql_Table_exists($GLOBALS['tables']['linktrack_uml_click'])) {
    output(s("creating tables"));
    Sql_Drop_Table($GLOBALS['tables']['linktrack_forward']);
    Sql_Drop_Table($GLOBALS['tables']['linktrack_ml']);
    Sql_Drop_Table($GLOBALS['tables']['linktrack_uml_click']);
    Sql_Create_Table($GLOBALS['tables']['linktrack_ml'], $DBstruct['linktrack_ml']);
    Sql_Create_Table($GLOBALS['tables']['linktrack_forward'], $DBstruct['linktrack_forward']);
    Sql_Create_Table($GLOBALS['tables']['linktrack_uml_click'], $DBstruct['linktrack_uml_click']);
    output(s("creating tables done"));
}
$process_id = getPageLock();
if (empty($process_id)) {
    return;
}
## only convert up to a week ago.
$lastweek = date('Y-m-d', time() - 24 * 7 * 3600);
cl_output(sprintf('select count(*) from %s lt, %s m where lt.messageid = m.id and m.entered < "%s"', $GLOBALS['tables']['linktrack'], $GLOBALS['tables']['message'], $lastweek));
$num = Sql_Fetch_Row_Query(sprintf('select count(*) from %s lt, %s m where lt.messageid = m.id and m.entered < "%s"', $GLOBALS['tables']['linktrack'], $GLOBALS['tables']['message'], $lastweek));
output(s("%d entries still to convert", $num[0]) . '<br/>');
$c = 0;
Ejemplo n.º 4
0
             while ($row2 = Sql_Fetch_array($req2)) {
                 if ($row2["name"] == "Checked") {
                     Sql_Query(sprintf('update %s set value = "on" where attributeid = %d and value = %d', $tables["user_attribute"], $row["id"], $row2["id"]));
                 }
             }
             Sql_Query(sprintf('update %s set value = "" where attributeid = %d and value != "on"', $tables["user_attribute"], $row["id"]));
             Sql_Drop_Table($table_prefix . 'listattr_' . $row['tablename']);
         }
         Sql_Query("insert into {$tables["task"]} (page,type) values(\"export\",\"user\")");
     case "1.6.3":
     case "1.6.4":
         Sql_Query("alter table {$tables["user"]} add column bouncecount integer default 0");
         Sql_Query("alter table {$tables["message"]} add column bouncecount integer default 0");
         # we actually never used these tables, so we can just as well drop and recreate them
         Sql_Drop_Table($tables['bounce']);
         Sql_Drop_Table($tables['user_message_bounce']);
         Sql_Query(sprintf('create table %s (
 id integer not null primary key auto_increment,
 date datetime,
 header text,
 data blob,
 status varchar(255),
 comment text)', $tables["bounce"]));
         Sql_Query(sprintf('create table %s (
 id integer not null primary key auto_increment,
 user integer not null,
 message integer not null,
 bounce integer not null,
 time timestamp,
 index (user,message,bounce))', $tables["user_message_bounce"]));
         Sql_Query("insert into {$tables["task"]} (page,type) values(\"bounce\",\"system\")");
 function initialise()
 {
     /* Make sure database is up to date */
     global $table_prefix;
     $imgtbl = $this->tables['image'];
     $msgtbl = $this->tables['msg'];
     if (Sql_Table_exists($imgtbl) && !Sql_Table_Column_Exists($imgtbl, "cksum") || Sql_Table_exists($msgtbl) && !Sql_Table_Column_Exists($msgtbl, "original")) {
         // Have old database tables?
         // Drop the old tables
         Sql_Drop_Table($imgtbl);
         Sql_Drop_Table($msgtbl);
         // Flag the plugin as not intialized so that the parent will create the new tables
         $entry = md5('plugin-inlineImagePlugin-initialised');
         $query = sprintf("delete from %s where item='%s'", $GLOBALS["tables"]["config"], $entry);
         Sql_Query($query);
         // Force reloading of config arrays, so that our parent sees the plugin
         // as not initialized.
         unset($_SESSION['config']);
         unset($GLOBALS['config']);
         unset($_SESSION["dbtables"]);
         // Empty the cache that still contains our table names
     }
     parent::initialise();
 }