[] ] ); } else { Editor::inst( $db, 'users' ) ->field( Field::inst( 'users.first_name' ), Field::inst( 'users.last_name' ), Field::inst( 'users.phone' ), Field::inst( 'users.site' ) ->options( 'sites', 'id', 'name' ) ->validator( 'Validate::dbValues' ), Field::inst( 'sites.name' ) ) ->join( Mjoin::inst( 'files' ) ->link( 'users.id', 'users_files.user_id' ) ->link( 'files.id', 'users_files.file_id' ) ->fields( Field::inst( 'id' ) ->upload( Upload::inst( 'upload/__ID__.__EXTN__' ) ->db( 'files', 'id', array( 'filename' => Upload::DB_FILE_NAME, 'filesize' => Upload::DB_FILE_SIZE, 'web_path' => Upload::DB_WEB_PATH, 'system_path' => Upload::DB_SYSTEM_PATH ) ) ->validator( Validate::fileSize( 500000, 'Files must be smaller that 500K' ) ) ->validator( Validate::fileExtensions( array( 'png', 'jpg', 'jpeg', 'gif' ), "Please upload an image" ) ) ) ) ) ->leftJoin( 'sites', 'sites.id', '=', 'users.site' ) ->where( 'site', $_POST['site'] ) ->process($_POST) ->json(); }