Пример #1
0
 /**
  * Convertation property for creation agent in queue through the old and dirty Bitrix API.
  */
 protected function convertation()
 {
     if ($this->executionTime instanceof DateTime) {
         $this->executionTime = $this->executionTime->toString();
     } elseif ($this->executionTime === null) {
         $time = new DateTime();
         $this->executionTime = $time->toString();
     }
     foreach (['periodically', 'active'] as $property) {
         if ($this->{$property} === true) {
             $this->{$property} = 'Y';
         } else {
             $this->{$property} = 'N';
         }
     }
 }
Пример #2
0
        if (ApplicationPasswordTable::getRow(array("filter" => array("=ID" => $id, "=USER_ID" => $USER->GetID()))) !== null) {
            $result = ApplicationPasswordTable::delete($id);
            if ($result->isSuccess()) {
                $answer["success"] = true;
                $answer["message"] = Loc::getMessage("main_app_passwords_ajax_deleted");
            } else {
                $answer["message"] = implode("<br>", $result->getErrorMessages());
            }
        }
    } elseif ($post["action"] == "add") {
        //adding a new application password
        $appManager = ApplicationManager::getInstance();
        $applications = $appManager->getApplications();
        $password = ApplicationPasswordTable::generatePassword();
        if (isset($applications[$post['APPLICATION_ID']])) {
            $date = new Main\Type\DateTime();
            $result = ApplicationPasswordTable::add(array('USER_ID' => $USER->GetID(), 'APPLICATION_ID' => $post['APPLICATION_ID'], 'PASSWORD' => $password, 'DATE_CREATE' => $date, 'COMMENT' => $post['COMMENT'], 'SYSCOMMENT' => $post['SYSCOMMENT']));
            if ($result->isSuccess()) {
                $answer["success"] = true;
                $answer["id"] = $result->getId();
                $answer["date_create"] = $date->toString();
                $answer["password"] = '******' . implode(str_split($password, 4), '</span><span>') . '</span>';
            } else {
                $answer["message"] = implode("<br>", $result->getErrorMessages());
            }
        } else {
            $answer["message"] = Loc::getMessage("main_app_passwords_ajax_no_app");
        }
    }
}
echo Json::encode($answer);