All pastes #375959 Raw Edit

Something

public text v1 · immutable
#375959 ·published 2007-02-28 19:14 UTC
rendered paste body
    function fetch_settings()
    {
        // Core-Settings
        $this->get_data("settings", "core", "option", "value");

        // Script-Settings
        $this->get_data("settings", $this->script, "option", "value");
    }

function get_data($table, $script, $c1, $c2)
    {
        // $table = Tabelle (z.B. Settings)
        // $script = Kürzel vom Script (z.B. obb)
        // $c1 = Spalte 1 / Column 1 (z.B. Option)
        // $c2 = Spalte 2 / Column 2 (z.B. Value)
        // Option -> Value

        $query = "
            SELECT ".$table.".*
            FROM scripts, ".$table."
            WHERE scripts.id = ".$table.".script
            AND scripts.short = '".$script."'";

        global $v3;

        $result = $v3->db->query($query);
        while($obj = mysql_fetch_object($result))
        {
            $var1 = $obj->$c1;
            $var2 = $obj->$c2;

            if($script == "core"){
                $v3->$script->$table->$var1 = $var2;
            }
            else{
                global $script;
                $script->$table->$var1 = $var2;
            }
        }
    }