/** * Constructs the listing class and sets the table * @param string $table Name of the table to work with * @return void */ public function __construct($table) { if (!Sql::tableExists($table)) { Kernel::Log($table . ' does not exist'); return false; } else { $this->table = $table; } }
/** * Constructs the class and verifies if the requirements have been met * @param string $id_field Column to identify the user through */ public function __construct($id_field = 'id') { self::$id_field = $id_field; $req_columns = array('id', 'username', 'email', 'password', 'lastactive'); if (Sql::tableExists('accounts') < 1) { Kernel::Log('The accounts table doesn\'t exist'); return false; } if (Sql::hasColumns('accounts', $req_columns) !== true) { Kernel::Log('The accounts table does not have the required columns'); return false; } return true; }