/** * Updates users avatar image file path in the DB. * * @param string $newAvatarFileName New filename. * * @return boolean Success flag. */ public function updateAvatar($newAvatarFileName) { $currentAvatarFileName = $this->avatar; if (!empty($currentAvatarFileName) && file_exists(Config::DIR_AVATARS . $currentAvatarFileName)) { unlink(Config::DIR_AVATARS . $currentAvatarFileName); } if (file_exists(Config::DIR_AVATARS . $newAvatarFileName)) { $query = "UPDATE " . self::TABLE_NAME . " SET avatar = ?" . " WHERE " . self::ID_FIELD_NAME . " = ?"; if (DBCore::doUpdateQuery($query, "si", array($newAvatarFileName, $this->id))) { $this->avatar = $newAvatarFileName; return true; } else { return false; } } else { return false; } }
function __construct() { $this->app = Core::coreInstance(); $this->db = DBCore::getInstance()->db; }
/** * Selects min value of some field by some predefined condition. * * @return int Number of records. */ public function min() { $query = "SELECT min(`" . $this->field . "`) FROM " . $this->dbObject->getTableName(); if ($this->conditions != "") { $query .= " WHERE " . $this->conditions; } return DBCore::selectSingleValue($query); }
public function save() { $query = "INSERT INTO " . self::TABLE_NAME . " (setting_id, value) VALUES (?, ?)\n ON DUPLICATE KEY UPDATE value = ?"; return DBCore::doUpdateQuery($query, "sss", array($this->id, $this->value, $this->value)); }
/** * Saves removement flag to the database. * * @return integer Returns the number of affected rows on success, and -1 if * the last query failed. */ public function saveRemovementFlag() { $this->changeUpdateTime(); return DBCore::doUpdateQuery("UPDATE " . static::TABLE_NAME . "\n SET removed = ?,\n update_time = ?,\n update_user_id = ?\n WHERE " . static::ID_FIELD_NAME . " = ?\n LIMIT 1", "isii", array($this->removed, $this->updateTime, $this->updateUserId, $this->id)); }
* * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The names of the author(s) of this software may not be used to endorse * or promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * AUTHORS OF THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require dirname(__FILE__) . '/../lib/common.php'; require dirname(__FILE__) . '/../lib/import.php'; $db = DBCore::connect(DB_IRI); if (!isset($argv[1])) { echo 'Usage: ' . $argv[0] . ' SOURCE ...' . "\n"; exit(1); } for ($c = 1; $c < count($argv); $c++) { AssetImport::import($db, $argv[$c]); }
ini_set('display_errors', 1); header("Content-Type:text/html;charset=UTF8", false); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Cache-Control: post-check=0,pre-check=0", false); header("Cache-Control: max-age=0", false); header("Pragma: no-cache"); mb_internal_encoding('utf-8'); define('ROOT', __DIR__ . '/'); function autoload($class) { require_once ROOT . "classes/{$class}.php"; } spl_autoload_register('autoload'); $obj = new DBCore(); ?> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <style> input[type="text"]{ width: 333px; margin: 5px; padding: 5px; } input[type="submit"]{