| @@ 269-283 (lines=15) @@ | ||
| 266 | * |
|
| 267 | * @return bool |
|
| 268 | */ |
|
| 269 | public function addConfig($name, $value) |
|
| 270 | { |
|
| 271 | $insert = sprintf( |
|
| 272 | "INSERT INTO |
|
| 273 | %sfaqinstances_config |
|
| 274 | VALUES |
|
| 275 | (%d, '%s', '%s')", |
|
| 276 | PMF_Db::getTablePrefix(), |
|
| 277 | $this->getId(), |
|
| 278 | $this->config->getDb()->escape(trim($name)), |
|
| 279 | $this->config->getDb()->escape(trim($value)) |
|
| 280 | ); |
|
| 281 | ||
| 282 | return $this->config->getDb()->query($insert); |
|
| 283 | } |
|
| 284 | ||
| 285 | /** |
|
| 286 | * Returns the configuration value. |
|
| @@ 123-137 (lines=15) @@ | ||
| 120 | * |
|
| 121 | * @return bool |
|
| 122 | */ |
|
| 123 | public function set($key, $value) |
|
| 124 | { |
|
| 125 | $query = sprintf("UPDATE %s%s SET config_value = '%s' WHERE config_name = '%s'", |
|
| 126 | PMF_Db::getTablePrefix(), |
|
| 127 | $this->_tableName, |
|
| 128 | $this->getDb()->escape(trim($value)), |
|
| 129 | $this->getDb()->escape(trim($key)) |
|
| 130 | ); |
|
| 131 | ||
| 132 | return $this->getDb()->query($query); |
|
| 133 | } |
|
| 134 | ||
| 135 | /** |
|
| 136 | * Sets the PMF_DB_Driver object. |
|
| 137 | * |
|
| 138 | * @param PMF_DB_Driver $database |
|
| 139 | */ |
|
| 140 | public function setDb(PMF_DB_Driver $database) |
|
| @@ 350-364 (lines=15) @@ | ||
| 347 | * |
|
| 348 | * @return bool |
|
| 349 | */ |
|
| 350 | public function add($name, $value) |
|
| 351 | { |
|
| 352 | $insert = sprintf( |
|
| 353 | "INSERT INTO |
|
| 354 | %s%s |
|
| 355 | VALUES |
|
| 356 | ('%s', '%s')", |
|
| 357 | PMF_Db::getTablePrefix(), |
|
| 358 | $this->_tableName, |
|
| 359 | $this->getDb()->escape(trim($name)), |
|
| 360 | $this->getDb()->escape(trim($value)) |
|
| 361 | ); |
|
| 362 | ||
| 363 | return $this->getDb()->query($insert); |
|
| 364 | } |
|
| 365 | ||
| 366 | /** |
|
| 367 | * Deletes a configuration item for the database. |
|
| @@ 373-386 (lines=14) @@ | ||
| 370 | * |
|
| 371 | * @return bool |
|
| 372 | */ |
|
| 373 | public function delete($name) |
|
| 374 | { |
|
| 375 | $delete = sprintf( |
|
| 376 | "DELETE FROM |
|
| 377 | %s%s |
|
| 378 | WHERE |
|
| 379 | config_name = '%s'", |
|
| 380 | PMF_Db::getTablePrefix(), |
|
| 381 | $this->_tableName, |
|
| 382 | $this->getDb()->escape(trim($name)) |
|
| 383 | ); |
|
| 384 | ||
| 385 | return $this->getDb()->query($delete); |
|
| 386 | } |
|
| 387 | ||
| 388 | /** |
|
| 389 | * Updates all configuration items. |
|