/** * dil fonksiyonu yuklenir * * public function load($name, $code = LANGUAGE_CODE) * * @param string $name * @param string $code */ public function load($name) { $code = $this->defaultLanguage; // lang dosyası $file = "app/language/" . $code . "/" . $name . "_lng.php"; // okunabilir mi if (is_readable($file)) { // dosya gerekli ... $this->_array = (include $file); } else { // hata bas die(\Controllers\Error::display("Dil dosyası bulunamadı '" . $code . "/" . $name_lng . ".php'")); } }
/** * Update Function * * Function used to update things on the database. * * @param string $table A name of table to insert into * @param string $data An associative array * @param string $where the WHERE query part */ public function update($table, $data, $where) { ksort($data); $fieldDetails = NULL; foreach ($data as $key => $value) { $fieldDetails .= "`{$key}`=:{$key},"; } $fieldDetails = rtrim($fieldDetails, ','); $sth = $this->prepare("UPDATE {$table} SET {$fieldDetails} WHERE {$where}"); foreach ($data as $key => $value) { $sth->bindValue(":{$key}", $value); } if (!$sth->execute()) { $error = new Error(); $error->index('500'); die; } }
/** * Update Function * * Function used to update things on the database. * * @param string $table A name of table to insert into * @param string $data An associative array * @param string $where the WHERE query part */ public function update($table, $data, $where, $dataWhere = array()) { ksort($data); $this->fieldDetails = null; foreach ($data as $key => $value) { $this->fieldDetails .= $key . '=:' . $key . ','; } $this->fieldDetails = rtrim($this->fieldDetails, ','); $sth = $this->prepare('UPDATE ' . $table . ' SET ' . $this->fieldDetails . ' WHERE ' . $where); foreach ($data as $key => $value) { $sth->bindValue(':' . $key, $value); } foreach ($dataWhere as $key => $value) { $sth->bindValue(':' . $key, $value); } if (!$sth->execute()) { $error = new Error(); $error->index('500'); die; } return $sth->rowCount(); }
public function error($code, $message) { $errorController = new Error(); $errorController->index($code, $message); }