404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.191.66.218: ~ $
<?php
class NextWordCallbackHandler extends CallBackhandler {
    public static $key= "nextWord";
    public static $spliter= "-";
    private $translations;
    private $currentWordIndex;
    public $searchedWord;
    function execute() {
        $wordAndIndex = explode(static::$spliter,$this->data);
        $searchedWord = $wordAndIndex[0];
        $this->currentWordIndex = $wordAndIndex[1];
        $this->searchedWord = $searchedWord;
        $this->translations = $this->getTG()->getDB()->getTrnslations(
            $searchedWord, $this->getTG()->getLang($searchedWord)
        );
        $this->updateMessage($this->translations[$this->currentWordIndex+1]);
    }
    public function getParent() : EvaluationSystem{
        return parent::getParent();
    }
    public function getTG() : TranslateGerman {
        return parent::getSM();
    }
    private function hasNext(){
        return $this->currentWordIndex+1 < sizeof($this->translations)-1;
    }

    private function updateMessage($word)
    {
        $likeButton = $this->getTG()->getButtonService()->findButton(LikeWordCallbackHandler::$key);
        $dislikeButton = $this->getTG()->getButtonService()->findButton(DislikeWordCallbackHandler::$key);
        $nextButton = $this->getTG()->getButtonService()->findButton(NextWordCallbackHandler::$key);

        
        $likeButton->setData($word['id']);
        $likeButton->setText("👍 ".$word['plusRate']);
        $dislikeButton->setData($word['id']);
        $dislikeButton->setText("👎 ".$word['minusRate']);
        $nextButtonData = $this->searchedWord.NextWordCallbackHandler::$spliter.($this->currentWordIndex+1);
        $nextButton->setData($nextButtonData);
        if(!$this->hasNext()){
            $this->getTG()->getButtonService()->deleteButton(NextWordCallbackHandler::$key);
        }
        // if($this->hasPrev() ){
            // throw new Exception("has prev ".$this->currentWordIndex. " size ".sizeof($this->translations));
        $prevButton = $this->getTG()->getButtonService()->findButton(PrevWordCallbackHandler::$key);
        $prevButtonData = $this->searchedWord.PrevWordCallbackHandler::$spliter.($this->currentWordIndex+1);
        $prevButton->setData($prevButtonData);
        $prevButton->setText("کلمه قبلی");
        if(!$prevButton->getUsed()){
            $this->getTG()->getButtonService()->addButton($prevButton);
        }
        // }
        $this->getTG()->getButtonService()->rebuildKeyboard();
        $this->getTG()->editMultpleButtonsMessage(
            $this->getTG()->styleTranslation($word),
            $this->getTG()->getButtonService()->getKeyboardMarkedup()
        );
    }
}
?>

Filemanager

Name Type Size Permission Actions
learn Folder 0755
DeDeTextTranslateCallbackHandler.class.php File 2.7 KB 0644
DeFaTextTranslateCallbackHandler.class.php File 2.71 KB 0644
DislikeWordCallbackHandler.class.php File 1.55 KB 0644
FaDeTextTranslateCallbackHandler.class.php File 2.71 KB 0644
LikeWordCallbackHandler.class.php File 1.53 KB 0644
NextWordCallbackHandler.class.php File 2.61 KB 0644
NotFoundCallbackHandler.class.php File 509 B 0644
PrevWordCallbackHandler.class.php File 2.36 KB 0644
ReportCallbackHandler.class.php File 1.21 KB 0644
UserWantsEvaluateCallbackHandler.class.php File 1.96 KB 0644