0) ? ", " : "") . "$key='$val'"; $keys .= (($i > 0) ? ", " : "") . "$key"; $vals .= (($i > 0) ? ", " : "") . "'$val'"; $i++; } if ($id>""){ $sql="UPDATE " . db_prefix("companions") . " SET $sql WHERE companionid='$id'"; }else{ $sql="INSERT INTO " . db_prefix("companions") . " ($keys) VALUES ($vals)"; } db_query($sql); invalidatedatacache("companiondata-$id"); if (db_affected_rows()>0){ output("`^Companion saved!`0`n`n"); }else{ // if (strlen($sql) > 400) $sql = substr($sql,0,200)." ... ".substr($sql,strlen($sql)-200); output("`^Companion `\$not`^ saved: `\$%s`0`n`n", $sql); } } } elseif ($subop=="module") { // Save modules settings $module = httpget("module"); $post = httpallpost(); reset($post); while(list($key, $val) = each($post)) { set_module_objpref("companions", $id, $key, $val, $module); } output("`^Saved!`0`n"); } if ($id) { $op="edit"; } else { $op = ""; } httpset("op", $op); } if ($op==""){ $sql = "SELECT * FROM " . db_prefix("companions") . " ORDER BY category, name"; $result = db_query($sql); $ops = translate_inline("Ops"); $name = translate_inline("Name"); $cost = translate_inline("Cost"); $edit = translate_inline("Edit"); $del = translate_inline("Del"); $take = translate_inline("Take"); $deac = translate_inline("Deactivate"); $act = translate_inline("Activate"); rawoutput("
$ops | $name | $cost | ||
"); output("Category: %s", $row['category']); rawoutput(" | ||||
[ $edit |"); addnav("","companions.php?op=edit&id={$row['companionid']}"); if ($row['companionactive']){ rawoutput("$del |"); }else{ $mconf = sprintf($conf, $companions[$row['companionid']]); rawoutput("$del |"); addnav("","companions.php?op=del&id={$row['companionid']}"); } if ($row['companionactive']) { rawoutput("$deac | "); addnav("","companions.php?op=deactivate&id={$row['companionid']}"); }else{ rawoutput("$act | "); addnav("","companions.php?op=activate&id={$row['companionid']}"); } rawoutput("$take ] | "); addnav("", "companions.php?op=take&id={$row['companionid']}"); rawoutput(""); output_notl("`&%s`0", $row['name']); rawoutput(" | "); output("`%%s gems`0, `^%s gold`0",$row['companioncostgems'], $row['companioncostgold']); rawoutput(" |