/** * Crear un nuevo usuario en la BBDD con los datos de LDAP. * Esta función crea los usuarios de LDAP en la BBDD para almacenar infomación del mismo * y utilizarlo en caso de fallo de LDAP * * @param User $User * @return bool */ public static function newUserLDAP(User $User) { $passdata = UserPass::makeUserPassHash($User->getUserPass()); $groupId = Config::getValue('ldap_defaultgroup', 0); $profileId = Config::getValue('ldap_defaultprofile', 0); $query = 'INSERT INTO usrData SET ' . 'user_name = :name,' . 'user_groupId = :groupId,' . 'user_login = :login,' . 'user_pass = :pass,' . 'user_hashSalt = :hashSalt,' . 'user_email = :email,' . 'user_notes = :notes,' . 'user_profileId = :profileId,' . 'user_isLdap = 1,' . 'user_isDisabled = :isDisabled'; $data['name'] = $User->getUserName(); $data['login'] = $User->getUserLogin(); $data['pass'] = $passdata['pass']; $data['hashSalt'] = $passdata['salt']; $data['email'] = $User->getUserEmail(); $data['notes'] = _('Usuario de LDAP'); $data['groupId'] = $groupId; $data['profileId'] = $profileId; $data['isDisabled'] = $groupId === 0 || $profileId === 0 ? 1 : 0; if (DB::getQuery($query, __FUNCTION__, $data) === false) { return false; } if (!$groupId || !$profileId) { $Log = new Log(_('Activación Cuenta')); $Log->addDescription(_('Su cuenta está pendiente de activación.')); $Log->addDescription(_('En breve recibirá un email de confirmación.')); $Log->writeLog(); Email::sendEmail($Log, $User->getUserEmail(), false); } Log::writeNewLogAndEmail(_('Nuevo usuario de LDAP'), sprintf("%s (%s)", $User->getUserName(), $User->getUserLogin())); return true; }
public function parse($text) { $partsArray = explode(",", $text); switch ($partsArray[0]) { case "led": $this->LED->parse($partsArray); break; default: Log::writeLog("Could not parse data", true); } }
public function downloadFile($pOwner, $pFilename) { Log::writeLog(1, $_SERVER['SCRIPT_NAME'], "User $pOwner is downloading file \"$pFilename\"."); $lFilePath = Config::$FilesRootDir . "/$pOwner/$pFilename"; header("Content-Type: application/force-download"); header("Content-Length: " . filesize($lFilePath)); header('Content-Disposition: attachment; filename="' . basename($lFilePath) . '"'); header("Content-Transfer-Encoding: binary\n"); header("Full-Path: |$lFilePath|\n"); readfile($lFilePath); }
/** * Migrar los perfiles con formato anterior a v1.2 * * @return bool */ public static function migrateProfiles() { $query = 'SELECT userprofile_id AS id,' . 'userprofile_name AS name,' . 'BIN(userProfile_pView) AS pView,' . 'BIN(userProfile_pViewPass) AS pViewPass,' . 'BIN(userProfile_pViewHistory) AS pViewHistory,' . 'BIN(userProfile_pEdit) AS pEdit,' . 'BIN(userProfile_pEditPass) AS pEditPass,' . 'BIN(userProfile_pAdd) AS pAdd,' . 'BIN(userProfile_pDelete) AS pDelete,' . 'BIN(userProfile_pFiles) AS pFiles,' . 'BIN(userProfile_pConfig) AS pConfig,' . 'BIN(userProfile_pConfigMasterPass) AS pConfigMasterPass,' . 'BIN(userProfile_pConfigBackup) AS pConfigBackup,' . 'BIN(userProfile_pAppMgmtCategories) AS pAppMgmtCategories,' . 'BIN(userProfile_pAppMgmtCustomers) AS pAppMgmtCustomers,' . 'BIN(userProfile_pUsers) AS pUsers,' . 'BIN(userProfile_pGroups) AS pGroups,' . 'BIN(userProfile_pProfiles) AS pProfiles,' . 'BIN(userProfile_pEventlog) AS pEventlog ' . 'FROM usrProfiles'; DB::setReturnArray(); $queryRes = DB::getResults($query, __FUNCTION__); if ($queryRes === false) { Log::writeNewLog(_('Migrar Perfiles'), _('Error al obtener perfiles')); return false; } foreach ($queryRes as $oldProfile) { $profile = new Profile(); $profile->setId($oldProfile->id); $profile->setName($oldProfile->name); $profile->setAccAdd($oldProfile->pAdd); $profile->setAccView($oldProfile->pView); $profile->setAccViewPass($oldProfile->pViewPass); $profile->setAccViewHistory($oldProfile->pViewHistory); $profile->setAccEdit($oldProfile->pEdit); $profile->setAccEditPass($oldProfile->pEditPass); $profile->setAccDelete($oldProfile->pDelete); $profile->setConfigGeneral($oldProfile->pConfig); $profile->setConfigEncryption($oldProfile->pConfigMasterPass); $profile->setConfigBackup($oldProfile->pConfigBackup); $profile->setMgmCategories($oldProfile->pAppMgmtCategories); $profile->setMgmCustomers($oldProfile->pAppMgmtCustomers); $profile->setMgmUsers($oldProfile->pUsers); $profile->setMgmGroups($oldProfile->pGroups); $profile->setMgmProfiles($oldProfile->pProfiles); $profile->setEvl($oldProfile->pEventlog); if ($profile->profileUpdate() === false) { return false; } } $query = 'ALTER TABLE usrProfiles ' . 'DROP COLUMN userProfile_pAppMgmtCustomers,' . 'DROP COLUMN userProfile_pAppMgmtCategories,' . 'DROP COLUMN userProfile_pAppMgmtMenu,' . 'DROP COLUMN userProfile_pUsersMenu,' . 'DROP COLUMN userProfile_pConfigMenu,' . 'DROP COLUMN userProfile_pFiles,' . 'DROP COLUMN userProfile_pViewHistory,' . 'DROP COLUMN userProfile_pEventlog,' . 'DROP COLUMN userProfile_pEditPass,' . 'DROP COLUMN userProfile_pViewPass,' . 'DROP COLUMN userProfile_pDelete,' . 'DROP COLUMN userProfile_pProfiles,' . 'DROP COLUMN userProfile_pGroups,' . 'DROP COLUMN userProfile_pUsers,' . 'DROP COLUMN userProfile_pConfigBackup,' . 'DROP COLUMN userProfile_pConfigMasterPass,' . 'DROP COLUMN userProfile_pConfig,' . 'DROP COLUMN userProfile_pAdd,' . 'DROP COLUMN userProfile_pEdit,' . 'DROP COLUMN userProfile_pView'; $queryRes = DB::getQuery($query, __FUNCTION__); $log = new Log(_('Migrar Perfiles')); if ($queryRes) { $log->addDescription(_('Operación realizada correctamente')); } else { $log->addDescription(_('Migrar Perfiles'), _('Fallo al realizar la operación')); } $log->writeLog(); Email::sendEmail($log); return $queryRes; }
/** * Actualizar la clave de un usuario desde phpPMS. * * @param string $userLogin con el login del usuario * @param string $userPass con la clave del usuario * @return bool * * Esta función actualiza la clave de un usuario que ha sido migrado desde phpPMS */ public static function migrateUser($userLogin, $userPass) { $passdata = UserPass::makeUserPassHash($userPass); $query = 'UPDATE usrData SET ' . 'user_pass = :pass,' . 'user_hashSalt = :salt,' . 'user_lastUpdate = NOW(),' . 'user_isMigrate = 0 ' . 'WHERE user_login = :login ' . 'AND user_isMigrate = 1 ' . 'AND (user_pass = SHA1(CONCAT(user_hashSalt,:passOld)) ' . 'OR user_pass = MD5(:passOldMd5)) LIMIT 1'; $data['pass'] = $passdata['pass']; $data['salt'] = $passdata['salt']; $data['login'] = $userLogin; $data['passOld'] = $userPass; $data['passOldMd5'] = $userPass; if (DB::getQuery($query, __FUNCTION__, $data) === false) { return false; } $log = new Log(__FUNCTION__); $log->addDescription(_('Usuario actualizado')); $log->addDescription('Login: ' . $userLogin); $log->writeLog(); Email::sendEmail($log); return true; }
/** * Enviar un email utilizando la clase PHPMailer. * * @param Log $log con el objeto del tipo Log * @param string $mailTo con el destinatario * @param bool $isEvent para indicar si es um * @return bool */ public static function sendEmail(Log $log, $mailTo = '', $isEvent = true) { if (!Util::mailIsEnabled()) { return false; } $mail = self::getEmailObject($mailTo, utf8_decode($log->getAction())); if (!is_object($mail)) { return false; } $mail->isHTML(); $log->setNewLineHtml(true); if ($isEvent === true) { $performer = Session::getUserLogin() ? Session::getUserLogin() : _('N/D'); $body[] = Html::strongText(_('Acción') . ": ") . utf8_decode($log->getAction()); $body[] = Html::strongText(_('Realizado por') . ": ") . $performer . ' (' . $_SERVER['REMOTE_ADDR'] . ')'; $mail->addCC(Config::getValue('mail_from')); } $body[] = utf8_decode($log->getDescription()); $body[] = ''; $body[] = '--'; $body[] = Util::getAppInfo('appname') . ' - ' . Util::getAppInfo('appdesc'); $body[] = Html::anchorText(Init::$WEBURI); $mail->Body = implode(Log::NEWLINE_HTML, $body); $sendMail = $mail->send(); $logEmail = new Log(_('Enviar Email')); // Enviar correo if ($sendMail) { $logEmail->addDescription(_('Correo enviado')); } else { $logEmail->addDescription(_('Error al enviar correo')); $logEmail->addDescription('ERROR: ' . $mail->ErrorInfo); } $logEmail->addDescription(_('Destinatario') . ': ' . $mailTo); if ($isEvent === true) { $logEmail->addDescription(_('CC') . ': ' . Config::getValue('mail_from')); } $logEmail->writeLog(); return $sendMail; }
protected function setLED($color, $value) { switch ($color) { case "R": if (LED::$status) { shell_exec("pigs p " . Config::$rPin . " " . $value); } LED::$r = $value; Log::writeLog("LED Red set to " . $value . "\r\n", true); break; case "G": if (LED::$status) { shell_exec("pigs p " . Config::$gPin . " " . $value); } LED::$g = $value; Log::writeLog("LED Green set to " . $value . "\r\n", true); break; case "B": if (LED::$status) { shell_exec("pigs p " . Config::$bPin . " " . $value); } LED::$b = $value; Log::writeLog("LED Blue set to " . $value . "\r\n", true); break; case "W": if (LED::$status) { shell_exec("pigs p " . Config::$rPin . " " . $value); shell_exec("pigs p " . Config::$gPin . " " . $value); shell_exec("pigs p " . Config::$bPin . " " . $value); } LED::$r = $value; LED::$g = $value; LED::$b = $value; Log::writeLog('All LEDs set to ' . $value . "\r\n", true); break; default: Log::writeLog("Could not write LED " . $color . " and power " . $value . "\r\n", 1); } }
} } else { // html output $page->show(); } } } } flush(); //add to search history session if (!isset($history) && ($q != '' || $where != '' || $filterSearch[0] != '')) { $solr_query = $result->diaServerResponse[0]->responseHeader->params->q != '*:*' ? $result->diaServerResponse[0]->responseHeader->params->q : ''; $solr_filter = $result->diaServerResponse[0]->responseHeader->params->fq; $solr_total = $result->diaServerResponse[0]->response->numFound; $_SESSION["search_history"][] = $solr_query . "|" . $solr_filter . "|" . $solr_total; } if ($config->log_dir != '') { // add to search log file $log = new Log(); $log->fields['ip'] = $_SERVER["REMOTE_ADDR"]; $log->fields['lang'] = $lang; $log->fields['col'] = $col; $log->fields['site'] = $site; $log->fields['query'] = $q != '' ? $q : "*"; $log->fields['index'] = $index != '' ? $index : "*"; $log->fields['where'] = $_REQUEST['where'] != '' ? $_REQUEST['where'] : "*"; $log->fields['filter'] = $dia->getFilterParam(); $page = ($from - 1) / $count + 1; $log->fields['from'] = strval($page) < 1 ? "1" : $page; $log->writeLog(); }
/** * Migrar la configuración desde phpPMS. * * @return array resultado */ private static function migrateConfig() { // Obtener la configuración actual self::getSourceConfig(); $skip = array('version', 'installed', 'install', 'dbhost', 'dbname', 'dbuser', 'dbpass', 'siteroot', 'sitelang', 'sitename', 'siteshortname', 'md5_pass', 'password_show', 'lastupdatempass', 'passwordsalt'); $totalParams = count(self::$_oldConfig); $num = 0; // Guardar la nueva configuración foreach (self::$_oldConfig as $key => $value) { if (array_key_exists($key, $skip)) { continue; } Config::setValue($key, $value); $num++; } $log = new Log(_('Importar Configuración')); $log->addDescription('OK'); $log->addDescription(_('Registros') . ': ' . $num . '/' . $totalParams); $log->writeLog(); }
/** * Guardar un parámetro de configuración en la BBDD. * * @param string $param con el parámetro a guardar * @param string $value con el valor a guardar * @param bool $email enviar email? * @return bool */ public static function setValue($param, $value, $email = true) { $query = "INSERT INTO config " . "SET config_parameter = :param," . "config_value = :value " . "ON DUPLICATE KEY UPDATE config_value = :valuedup"; $data['param'] = $param; $data['value'] = $value; $data['valuedup'] = $value; if (DB::getQuery($query, __FUNCTION__, $data) === false) { return false; } $log = new Log(_('Configuración')); $log->addDescription(_('Modificar configuración')); $log->addDescription(_('Parámetro') . ': ' . $param); $log->addDescription(_('Valor') . ': ' . $value); $log->writeLog(); if ($email === true) { Email::sendEmail($log); } return true; }
/** * Modificar un usuario. * * @return bool */ public function updateUser() { $query = 'UPDATE usrData SET ' . 'user_name = :name,' . 'user_login = :login,' . 'user_email = :email,' . 'user_notes = :notes,' . 'user_groupId = :groupId,' . 'user_profileId = :profileId,' . 'user_isAdminApp = :isAdminApp,' . 'user_isAdminAcc = :isAdminAcc,' . 'user_isDisabled = :isDisabled,' . 'user_isChangePass = :isChangePass,' . 'user_lastUpdate = NOW() ' . 'WHERE user_id = :id LIMIT 1'; $data['name'] = $this->_userName; $data['login'] = $this->_userLogin; $data['email'] = $this->_userEmail; $data['notes'] = $this->_userNotes; $data['groupId'] = $this->_userGroupId; $data['profileId'] = $this->_userProfileId; $data['isAdminApp'] = intval($this->_userIsAdminApp); $data['isAdminAcc'] = intval($this->_userIsAdminAcc); $data['isDisabled'] = intval($this->_userIsDisabled); $data['isChangePass'] = intval($this->_userChangePass); $data['id'] = $this->_userId; if (DB::getQuery($query, __FUNCTION__, $data) === false) { return false; } $this->queryLastId = DB::$lastId; $Log = new Log(_('Modificar Usuario')); $Log->addDescription(sprintf('%s: %s (%s)', Html::strongText(_('Usuario')), $this->_userName, $this->_userLogin)); if ($this->_userChangePass) { if (!Auth::mailPassRecover(DB::escape($this->_userLogin), DB::escape($this->_userEmail))) { $Log->addDescription(Html::strongText(_('No se pudo realizar la petición de cambio de clave.'))); } } $Log->writeLog(); Email::sendEmail($Log); return true; }
public function removeVideo($pVideoID) { $lDB = new Database(); $lDB->connect(); Log::writeLog(1, $_SERVER["SCRIPT_NAME"], "Removing video with ID $pVideoID"); $lStatement = "DELETE FROM Conversions WHERE ID = $pVideoID"; $lDB->delete($lStatement); $lDB->disconnect(); }
/** * Actualizar los datos encriptados con una nueva clave * * @param string $currentMasterPass La clave maestra actual * @param string $newMasterPassword La nueva clave maestra * @return bool * @throws SPException */ public static function updateCustomFieldsCrypt($currentMasterPass, $newMasterPassword) { $Log = new Log(); $Log->setAction(_('Campos Personalizados')); $query = 'SELECT customfielddata_id, customfielddata_data, customfielddata_iv FROM customFieldsData'; DB::setReturnArray(); $queryRes = DB::getResults($query, __FUNCTION__); if ($queryRes === false) { $Log->addDescription(_('Fin')); $Log->writeLog(); return true; } $Log->addDescription(_('Actualizando datos encriptados')); $Log->writeLog(true); $errors = array(); $success = array(); foreach ($queryRes as $customField) { $fieldData = Crypt::getDecrypt($customField->customfielddata_data, $customField->customfielddata_iv, $currentMasterPass); $fieldCryptData = Crypt::encryptData($fieldData, $newMasterPassword); $query = 'UPDATE customFieldsData SET ' . 'customfielddata_data = :data, ' . 'customfielddata_iv = :iv ' . 'WHERE customfielddata_id = :id '; $data['id'] = $customField->customfielddata_id; $data['data'] = $fieldCryptData['data']; $data['iv'] = $fieldCryptData['iv']; if (DB::getQuery($query, __FUNCTION__, $data) === false) { $errors[] = $customField->customfielddata_id; } else { $success[] = $customField->customfielddata_id; } } if (count($errors) > 0) { $Log->addDescription(_('Registros no actualizados') . ': ' . implode(',', $errors)); $Log->writeLog(true); } if (count($success) > 0) { $Log->addDescription(_('Registros actualizados') . ': ' . implode(',', $success)); $Log->writeLog(true); } $Log->addDescription(_('Fin')); $Log->writeLog(); return count($errors) === 0; }
$header = socket_read($socket_new, 1024); perform_handshaking($header, $socket_new, $host, $port); socket_getpeername($socket_new, $ip); Log::writeLog("Client " . $ip . " connected\n", true); $response = mask(json_encode(array('server' => $ip . ' connected'))); send_message($response); send_message(mask(json_encode($IO->generateNewClientPacket()))); $found_socket = array_search($socket, $changed); unset($changed[$found_socket]); } foreach ($changed as $changed_socket) { while (socket_recv($changed_socket, $buf, 1024, 0) >= 1) { $received_text = unmask($buf); $jsonObject = json_decode($received_text); $createResponse = json_encode(array('server' => $ip . ' : ' . utf8_encode($received_text))); Log::writeLog($received_text . "\r\n", true); $IO->parse($received_text); $response_text = mask($createResponse); send_message($response_text); break 2; } $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ); if ($buf === false) { $found_socket = array_search($changed_socket, $clients); socket_getpeername($changed_socket, $ip); unset($clients[$found_socket]); $response = mask(json_encode(array('server' => $ip . ' disconnected'))); send_message($response); } } }
static function start() { try { Session::start(); //загрузка параметров движка Settings::$ENGINE = Engine::loadSettings(); //проверка закрыт сайт или нет if (Settings::$ENGINE['site'] == 0) { View::renderClosed('Извините, доступ на сайт закрыт'); } View::$template = Settings::$ENGINE['template']; Controller::$lang = Settings::$ENGINE['default_lang']; $route = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); //считываем из сессии id пользователя (-1 назначаем неавторизованным пользователям) $user_id = -1; if (isset($_SESSION['uid']) && !empty($_SESSION['uid']) && is_numeric($_SESSION['uid'])) { $user_id = $_SESSION['uid']; } /*$pwd = "ruh"; $hash = Crypt::password_hash($pwd); if(Crypt::password_verify($pwd,$hash)) echo "true"; else echo "false"; exit;*/ /*print_r(AclModel::getRoles()); exit;*/ //проверяем, не был ли передан тип запроса (например при ajax запросе) $request_type = null; if (isset($_POST["request_type"]) && is_numeric($_POST["request_type"])) { $request_type = $_POST["request_type"]; ini_set('display_errors', 0); } else { $page = PageManager::findPage($route == '/' ? '/main' : $route); if (!$page) { throw new Exception404(); } View::setTitle($page['title']); View::css(explode('|', $page['css'])); View::js(explode('|', $page['js'])); //TODO: замутить парсер META $args = json_decode($page['content'], true); foreach ($args as $key => $val) { $class = new $args[$key]['c'](); View::$args[$key] = $class->{$args}[$key]['m'](!empty($args[$key]['a']) ? $args[$key]['a'] : null); } //print_r(View::$args); View::render('index', Settings::$ENGINE['template']); } //Если страницы не были найдены, то обращаемся напрямую к контроллеру $routes = explode('/', $route); array_shift($routes); if ($routes) { //задаем контроллер и его метод по умолчанию $controller_name = Settings::$DEFAULT_CONTROLLER; $action = 'index'; //распарсиваем адресную строку //определяем имя контроллера if (!empty($routes[0])) { $controller_name = $routes[0]; } //его метод if (!empty($routes[1])) { $action = $routes[1]; } //все остальные параметры адресной строки преобразуем в аргументы $i = 2; $arg = array(); while (!empty($routes[$i])) { $arg[] = $routes[$i++]; } //создаем объект для работы контроллером if (!class_exists($controller_name)) { throw new Exception404(); } $controller = new $controller_name(); //проверяем, если это пост запрос c request_type, обрабатываем его соответственно if ($request_type != null) { //проверяем, есть ли данный метод у контроллера if (method_exists($controller_name, $action)) { //если метод есть, то //запускаем главную функцию обработки запроса $res = $controller->{$action}(isset($arg) ? $arg : NULL); //выводим результат echo json_encode(array('answer' => $res)); } else { //если функция не видна, то выдаем сответствующюю инфу echo json_encode(array("error" => 'Не найдена функция для обработки запроса (' . $controller_name . '::' . $action . ')!')); } exit; } //если это не запрос, просто вызываем метод $controller->{$action}(isset($arg) ? $arg : NULL); unset($routes); } else { throw new Exception404(); } } catch (mysqli_sql_exception $e) { if (Settings::$DEBUG) { echo '<br>DEBUG: mysqli_sql_exception: ' . $e->getMessage() . ' => ' . $e->getCode() . '<br>'; } Log::writeLog($e->getMessage() . ' ' . $e->getCode()); } catch (Exception404 $e) { // Здесь сделаем так, что бы 404 выдавалось в контент или куда-то еще, что бы не нарушать целостность сайта // View::render404(); echo '404'; } catch (Exception $e) { if (Settings::$DEBUG) { echo '<br>DEBUG: Exception: ' . $e->getMessage() . ' => ' . $e->getCode() . '<br>'; } } //// проверка на запрещенные или разрешенные IP-адреса // if(Settings::$ENGINE['checkIP'] > 0) // { // $ip = Engine::checkIp($_SERVER['REMOTE_ADDR']); // // if($ip && Settings::$ENGINE['checkIP'] == 1) // View::renderClosed($ip['reason'], $ip['date']); // else // if(!$ip && Settings::$ENGINE['checkIP'] == 2) // View::renderClosed('Доступ к сайту с Вашего IP-адреса запрещен'); // } // // /** // * проверка на запрещенные или разрешенные ОС, браузеры или их версии // * TODO: тут, по-хороошему, нужно поближе рассмотреть этот мехвнизм, обточить // */ // if(Settings::$ENGINE['checkFStuff'] > 0) // { // $r = Engine::checkForbiddenStuff(self::getUserBrowser()); // if($r && Settings::$ENGINE['checkFStuff'] == 1) // View::renderClosed($r); // else // if(!$r && Settings::$ENGINE['checkFStuff'] == 2) // View::renderClosed('Сайт не поддерживает работу с Вашими устройствами'); // } // // //// проверка включена ли мультиязычность или нет, по умолчанию используется только русский язык // if(Settings::$ENGINE['multiLang']) // if(!empty($_COOKIE['lang'])) // Controller::$lang = $_COOKIE['lang']; }
/** * Actualiza las claves de todas las cuentas en el histórico con la nueva clave maestra. * * @param string $currentMasterPass con la clave maestra actual * @param string $newMasterPass con la nueva clave maestra * @param string $newHash con el nuevo hash de la clave maestra * @return bool */ public function updateAccountsMasterPass($currentMasterPass, $newMasterPass, $newHash = null) { $idOk = array(); $errorCount = 0; $demoEnabled = Util::demoIsEnabled(); $log = new Log(_('Actualizar Clave Maestra (H)')); $log->addDescription(_('Inicio')); $log->writeLog(); $log->resetDescription(); if (!Crypt::checkCryptModule()) { $log->addDescription(_('Error en el módulo de encriptación')); $log->writeLog(); return false; } $accountsPass = $this->getAccountsPassData(); if (!$accountsPass) { $log->addDescription(_('Error al obtener las claves de las cuentas')); $log->writeLog(); return false; } foreach ($accountsPass as $account) { $this->setAccountId($account->acchistory_id); // No realizar cambios si está en modo demo if ($demoEnabled) { $idOk[] = $account->acchistory_id; continue; } if (!$this->checkAccountMPass()) { $errorCount++; $log->addDescription(_('La clave maestra del registro no coincide') . ' (' . $account->acchistory_id . ') ' . $account->acchistory_name); continue; } if (strlen($account->acchistory_pass) === 0) { $log->addDescription(_('Clave de cuenta vacía') . ' (' . $account->acchistory_id . ') ' . $account->acchistory_name); continue; } if (strlen($account->acchistory_IV) < 32) { $log->addDescription(_('IV de encriptación incorrecto') . ' (' . $account->acchistory_id . ') ' . $account->acchistory_name); } $decryptedPass = Crypt::getDecrypt($account->acchistory_pass, $account->acchistory_IV); $this->setAccountPass(Crypt::mkEncrypt($decryptedPass, $newMasterPass)); $this->setAccountIV(Crypt::$strInitialVector); if ($this->getAccountPass() === false) { $errorCount++; $log->addDescription(_('No es posible desencriptar la clave de la cuenta') . ' (' . $account->acchistory_id . ') ' . $account->acchistory_name); continue; } if (!$this->updateAccountPass($account->acchistory_id, $newHash)) { $errorCount++; $log->addDescription(_('Fallo al actualizar la clave del histórico') . ' (' . $account->acchistory_id . ') ' . $account->acchistory_name); continue; } $idOk[] = $account->acchistory_id; } // Vaciar el array de mensaje de log if (count($log->getDescription()) > 0) { $log->writeLog(); $log->resetDescription(); } if ($idOk) { $log->addDescription(_('Registros actualizados') . ': ' . implode(',', $idOk)); $log->writeLog(); $log->resetDescription(); } $log->addDescription(_('Fin')); $log->writeLog(); return true; }
else echo " }\n"; } } elseif (array_key_exists('VideoID', $lResult) && array_key_exists('Status', $lResult) && array_key_exists('Description', $lResult)) { $lVideoID = $lResult['VideoID']; $lStatus = $lResult['Status']; $lStatusStr = Videos::$Status[$lStatus]; $lDescr = $lResult['Description']; echo " {\n"; echo " \"ytid\": \"$lVideoID\",\n"; echo " \"stat\": \"$lStatus\",\n"; echo " \"statstr\": \"$lStatusStr\",\n"; echo " \"desc\": \"$lDescr\"\n"; echo " }\n"; } $lDB->disconnect(); } else { Log::writeLog(1, $_SERVER["SCRIPT_NAME"], "User ID \"$gUID\" is wrong."); } echo "]}\n"; ?>
/** * Obtener los datos de las entradas de sysPass y crearlas * * @throws SPException */ protected function processAccounts() { $line = 0; $lines = $this->_file->getFileContent(); foreach ($lines as $data) { $line++; $fields = explode($this->_fieldDelimiter, $data); $numfields = count($fields); // Comprobar el número de campos de la línea if ($numfields !== $this->_numFields) { throw new SPException(SPException::SP_CRITICAL, sprintf(_('El número de campos es incorrecto (%d)'), $numfields), sprintf(_('Compruebe el formato del archivo CSV en línea %s'), $line)); } // Eliminar las " del principio/fin de los campos array_walk($fields, function (&$value, $key) { $value = trim($value, '"'); }); // Asignar los valores del array a variables list($accountName, $customerName, $categoryName, $url, $login, $password, $notes) = $fields; // Obtener los ids de cliente, categoría y la clave encriptada $customerId = Customer::addCustomerReturnId($customerName); $categoryId = Category::addCategoryReturnId($categoryName); $pass = Crypt::encryptData($password); // Crear la nueva cuenta $this->setAccountName($accountName); $this->setAccountLogin($login); $this->setCategoryId($categoryId); $this->setCustomerId($customerId); $this->setAccountNotes($notes); $this->setAccountUrl($url); $this->setAccountPass($pass['data']); $this->setAccountPassIV($pass['iv']); if (!$this->addAccount()) { $log = new Log(_('Importar Cuentas')); $log->addDescription(_('Error importando cuenta')); $log->addDescription(sprintf(_('Error procesando línea %s'), $line)); $log->writeLog(); } else { Log::writeNewLog(_('Importar Cuentas'), sprintf(_('Cuenta importada: %s'), $accountName)); } } }
/* * Initialize parameter variables. */ $gVID = isset($_POST['vid'])?$_POST['vid']:$_GET['vid']; $gUID = isset($_POST['uid'])?$_POST['uid']:$_GET['uid']; if (Security::containsIllegalChars($gUID)) { Log::writeLog(1, $_SERVER["SCRIPT_NAME"], "User ID \"$gUID\" contains illegal characters."); } elseif (Security::containsIllegalChars($gVID)) { Log::writeLog(1, $_SERVER["SCRIPT_NAME"], "Video ID \"$gVID\" contains illegal characters."); } elseif (strlen($gUID) > 0 && strlen($gVID) > 0 && Youtube::validYoutubeID($gVID)) { /* * Find video entry. */ $gLocalSrch = new Videos(); $gLocalSrchResult = $gLocalSrch->getSongByID($gVID); $lVideoTitle = (strlen($gLocalSrchResult[VideoTitle])>64)?substr($gLocalSrchResult[VideoTitle], 0, 64)."...":$gLocalSrchResult[VideoTitle]; /* * Insert transcode request into db. */ $lClientIP = isset($_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR']; $lStatement = "INSERT INTO Conversions (Timestamp, VideoID, RequestingUID, ClientIP, Description) Values(NOW(), '$gVID', '$gUID', '$lClientIP', '$lVideoTitle')";
/** * Buscar al usuario en un grupo. * * @param string $userLogin con el login del usuario * @throws \Exception * @return bool */ public static function searchADUserInGroup($userLogin) { if (Ldap::$_isADS === false) { return false; } $log = new Log(__FUNCTION__); $ldapGroup = Config::getValue('ldap_group'); // El filtro de grupo no está establecido if (empty($ldapGroup)) { return true; } // Obtenemos el DN del grupo if (!($groupDN = Ldap::searchGroupDN())) { return false; } $filter = '(memberof:1.2.840.113556.1.4.1941:=' . $groupDN . ')'; $filterAttr = array("sAMAccountName"); $searchRes = @ldap_search(Ldap::$_ldapConn, Ldap::$_searchBase, $filter, $filterAttr); if (!$searchRes) { $log->addDescription(_('Error al buscar el grupo de usuarios')); $log->addDescription('LDAP ERROR: ' . ldap_error(Ldap::$_ldapConn) . '(' . ldap_errno(Ldap::$_ldapConn) . ')'); $log->addDescription('LDAP FILTER: ' . $filter); $log->writeLog(); throw new \Exception(_('Error al buscar el grupo de usuarios')); } if (@ldap_count_entries(Ldap::$_ldapConn, $searchRes) === 0) { $log->addDescription(_('No se encontró el grupo con ese nombre')); $log->addDescription('LDAP ERROR: ' . ldap_error(Ldap::$_ldapConn) . '(' . ldap_errno(Ldap::$_ldapConn) . ')'); $log->addDescription('LDAP FILTER: ' . $filter); $log->writeLog(); throw new \Exception(_('No se encontró el grupo con ese nombre')); } foreach (ldap_get_entries(Ldap::$_ldapConn, $searchRes) as $entry) { if ($userLogin === $entry['samaccountname'][0]) { return true; } } return false; }
/** * Obtener una nueva instancia de la clase inicializada * * @param $action string La acción realizada * @param null $description string La descripción de la acción realizada * @return Log */ public static function writeNewLogAndEmail($action, $description = null) { $log = new Log($action, $description); $log->writeLog(); Email::sendEmail($log); return $log; }
public function update($pStatement) { Log::writeLog(3, $_SERVER["SCRIPT_NAME"], "(0) : \"$pStatement\""); if ($query = @mysql_query($pStatement)) return true; else return false; }
$lResult = $lDB->getResult(); $lDB->disconnect(); if (array_key_exists('ID', $lResult) && array_key_exists('DataContainer', $lResult)) { $lID = $lResult['ID']; $lVideoID = $lResult['VideoID']; $lStatus = $lResult['Status']; $lStatusStr = Videos::$Status[$lStatus]; $lDescr = $lResult['Description']; $lDataContainer = $lResult['DataContainer']; $lFile = new Files(); $lFile->downloadFile($gUID, $lDataContainer); # Remove file and DB entry $lFile->removeFile($gUID, $lDataContainer); $lVideos = new Videos(); $lVideos->removeVideo($lID); } else { Log::writeLog(1, $_SERVER["SCRIPT_NAME"], "User with ID $gUID can't download $gVID"); } } ?>
$index = stripos($titleC, "<i>"); $substr = substr($titleC, 0, $index); $substr1 = strip_tags($substr); foreach ($title as $key => $value) { foreach ($value->find('a') as $key => $value1) { $link = $value1->href; echo "<a class=\"navigate-right\" data-transition=\"slide-in\" href=\"film.php?link={$link}&name={$substr1}\">"; } } foreach ($cell[$i]->find('img') as $key => $img) { $image = $img->src; echo "<img class=\"media-object pull-left\" src={$image} alt='image/nofound'/> " . "<div class=\"media-body\">"; } foreach ($title as $key => $value) { foreach ($value->find('a') as $key => $value1) { foreach ($value1->find('b') as $key => $value2) { echo $value2; echo '<br><br>'; } } } $pf = strip_tags($douban[0]->outertext, '<em><strong>'); echo $pf; echo "</div>" . "</a>" . "</li>"; } } } echo " </ul>" . "</div>" . "</html>" . ""; $log = new Log('log'); $log->writeLog($name);
/** * Actualiza la BBDD según la versión. * * @param int $version con la versión a actualizar * @returns bool */ private static function upgradeTo($version) { $log = new Log(_('Actualizar BBDD')); switch ($version) { case 110: $queries[] = 'ALTER TABLE `accFiles` CHANGE COLUMN `accfile_name` `accfile_name` VARCHAR(100) NOT NULL'; $queries[] = 'ALTER TABLE `accounts` ADD COLUMN `account_otherGroupEdit` BIT(1) NULL DEFAULT 0 AFTER `account_dateEdit`, ADD COLUMN `account_otherUserEdit` BIT(1) NULL DEFAULT 0 AFTER `account_otherGroupEdit`;'; $queries[] = 'CREATE TABLE `accUsers` (`accuser_id` INT NOT NULL AUTO_INCREMENT,`accuser_accountId` INT(10) UNSIGNED NOT NULL,`accuser_userId` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`accuser_id`), INDEX `idx_account` (`accuser_accountId` ASC)) DEFAULT CHARSET=utf8;'; $queries[] = 'ALTER TABLE `accHistory` ADD COLUMN `accHistory_otherUserEdit` BIT NULL AFTER `acchistory_mPassHash`, ADD COLUMN `accHistory_otherGroupEdit` VARCHAR(45) NULL AFTER `accHistory_otherUserEdit`;'; $queries[] = 'ALTER TABLE `accFiles` CHANGE COLUMN `accfile_type` `accfile_type` VARCHAR(100) NOT NULL ;'; break; case 1121: $queries[] = 'ALTER TABLE `categories` ADD COLUMN `category_description` VARCHAR(255) NULL AFTER `category_name`;'; $queries[] = 'ALTER TABLE `usrProfiles` ADD COLUMN `userProfile_pAppMgmtMenu` BIT(1) NULL DEFAULT b\'0\' AFTER `userProfile_pUsersMenu`,CHANGE COLUMN `userProfile_pConfigCategories` `userProfile_pAppMgmtCategories` BIT(1) NULL DEFAULT b\'0\' AFTER `userProfile_pAppMgmtMenu`,ADD COLUMN `userProfile_pAppMgmtCustomers` BIT(1) NULL DEFAULT b\'0\' AFTER `userProfile_pAppMgmtCategories`;'; break; case 1122: $queries[] = 'ALTER TABLE `usrData` CHANGE COLUMN `user_login` `user_login` VARCHAR(50) NOT NULL ,CHANGE COLUMN `user_email` `user_email` VARCHAR(80) NULL DEFAULT NULL ;'; break; case 1123: $queries[] = 'CREATE TABLE `usrPassRecover` (`userpassr_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `userpassr_userId` SMALLINT UNSIGNED NOT NULL,`userpassr_hash` VARBINARY(40) NOT NULL,`userpassr_date` INT UNSIGNED NOT NULL,`userpassr_used` BIT(1) NOT NULL DEFAULT b\'0\', PRIMARY KEY (`userpassr_id`),INDEX `IDX_userId` (`userpassr_userId` ASC, `userpassr_date` ASC)) DEFAULT CHARSET=utf8;'; $queries[] = 'ALTER TABLE `log` ADD COLUMN `log_ipAddress` VARCHAR(45) NOT NULL AFTER `log_userId`;'; $queries[] = 'ALTER TABLE `usrData` ADD COLUMN `user_isChangePass` BIT(1) NULL DEFAULT b\'0\' AFTER `user_isMigrate`;'; break; case 11213: $queries[] = 'ALTER TABLE `usrData` CHANGE COLUMN `user_mPass` `user_mPass` VARBINARY(32) NULL DEFAULT NULL ,CHANGE COLUMN `user_lastLogin` `user_lastLogin` DATETIME NULL DEFAULT NULL ,CHANGE COLUMN `user_lastUpdate` `user_lastUpdate` DATETIME NULL DEFAULT NULL, CHANGE COLUMN `user_mIV` `user_mIV` VARBINARY(32) NULL ;'; $queries[] = 'ALTER TABLE `accounts` CHANGE COLUMN `account_login` `account_login` VARCHAR(50) NULL DEFAULT NULL ;'; break; case 11219: $queries[] = 'ALTER TABLE `accounts` CHANGE COLUMN `account_pass` `account_pass` VARBINARY(255) NOT NULL ;'; $queries[] = 'ALTER TABLE `accHistory` CHANGE COLUMN `acchistory_pass` `acchistory_pass` VARBINARY(255) NOT NULL ;'; break; case 11220: $queries[] = 'ALTER TABLE `usrData` CHANGE COLUMN `user_pass` `user_pass` VARBINARY(255) NOT NULL,CHANGE COLUMN `user_mPass` `user_mPass` VARBINARY(255) DEFAULT NULL ;'; break; case 12001: $queries[] = 'ALTER TABLE `accounts` CHANGE COLUMN `account_userEditId` `account_userEditId` TINYINT(3) UNSIGNED NULL DEFAULT NULL, CHANGE COLUMN `account_dateEdit` `account_dateEdit` DATETIME NULL DEFAULT NULL;'; $queries[] = 'ALTER TABLE `accHistory` CHANGE COLUMN `acchistory_userEditId` `acchistory_userEditId` TINYINT(3) UNSIGNED NULL DEFAULT NULL, CHANGE COLUMN `acchistory_dateEdit` `acchistory_dateEdit` DATETIME NULL DEFAULT NULL;'; $queries[] = 'ALTER TABLE `accHistory` CHANGE COLUMN `accHistory_otherGroupEdit` `accHistory_otherGroupEdit` BIT NULL DEFAULT b\'0\';'; $queries[] = 'ALTER TABLE `usrProfiles` ADD COLUMN `userProfile_profile` BLOB NOT NULL;'; $queries[] = 'ALTER TABLE `usrData` ADD `user_preferences` BLOB NULL;'; $queries[] = 'CREATE TABLE usrToGroups (usertogroup_id INT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,usertogroup_userId INT UNSIGNED NOT NULL,usertogroup_groupId INT UNSIGNED NOT NULL) DEFAULT CHARSET=utf8;'; $queries[] = 'CREATE INDEX IDX_accountId ON usrToGroups (usertogroup_userId)'; $queries[] = 'ALTER TABLE `accFiles` ADD `accFile_thumb` BLOB NULL;'; $queries[] = 'CREATE TABLE `authTokens` (`authtoken_id` int(11) NOT NULL AUTO_INCREMENT,`authtoken_userId` int(11) NOT NULL,`authtoken_token` varbinary(100) NOT NULL,`authtoken_actionId` smallint(5) unsigned NOT NULL,`authtoken_createdBy` smallint(5) unsigned NOT NULL,`authtoken_startDate` int(10) unsigned NOT NULL,PRIMARY KEY (`authtoken_id`),UNIQUE KEY `unique_authtoken_id` (`authtoken_id`),KEY `IDX_checkToken` (`authtoken_userId`,`authtoken_actionId`,`authtoken_token`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;'; $queries[] = 'CREATE TABLE `customFieldsDef` (`customfielddef_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `customfielddef_module` smallint(5) unsigned NOT NULL, `customfielddef_field` blob NOT NULL, PRIMARY KEY (`customfielddef_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;'; $queries[] = 'CREATE TABLE `customFieldsData` (`customfielddata_id` int(10) unsigned NOT NULL AUTO_INCREMENT,`customfielddata_moduleId` smallint(5) unsigned NOT NULL,`customfielddata_itemId` int(10) unsigned NOT NULL,`customfielddata_defId` int(10) unsigned NOT NULL,`customfielddata_data` longblob,`customfielddata_iv` varbinary(128) DEFAULT NULL, PRIMARY KEY (`customfielddata_id`), KEY `IDX_DEFID` (`customfielddata_defId`), KEY `IDX_DELETE` (`customfielddata_itemId`,`customfielddata_moduleId`), KEY `IDX_UPDATE` (`customfielddata_moduleId`,`customfielddata_itemId`,`customfielddata_defId`), KEY `IDX_ITEM` (`customfielddata_itemId`), KEY `IDX_MODULE` (`customfielddata_moduleId`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;'; break; case 12002: $queries[] = 'ALTER TABLE config CHANGE config_value config_value VARCHAR(255);'; $queries[] = 'ALTER TABLE usrData CHANGE user_pass user_pass VARBINARY(255);'; $queries[] = 'ALTER TABLE usrData CHANGE user_hashSalt user_hashSalt VARBINARY(128);'; $queries[] = 'ALTER TABLE accHistory CHANGE acchistory_mPassHash acchistory_mPassHash VARBINARY(255);'; break; default: $log->addDescription(_('No es necesario actualizar la Base de Datos.')); return true; } foreach ($queries as $query) { try { DB::getQuery($query, __FUNCTION__); } catch (SPException $e) { $log->addDescription(_('Error al aplicar la actualización de la Base de Datos.') . ' (v' . $version . ')'); $log->addDescription('ERROR: ' . $e->getMessage() . ' (' . $e->getCode() . ')'); $log->writeLog(); Email::sendEmail($log); return false; } } $log->addDescription(_('Actualización de la Base de Datos realizada correctamente.') . ' (v' . $version . ')'); $log->writeLog(); Email::sendEmail($log); return true; }
/** * Actualiza la clave de una cuenta en la BBDD. * * @param bool $isMassive para no actualizar el histórico ni enviar mensajes * @param bool $isRestore indica si es una restauración * @return bool */ public function updateAccountPass($isMassive = false, $isRestore = false) { $Log = new Log(__FUNCTION__); // No actualizar el histórico si es por cambio de clave maestra o restauración if (!$isMassive && !$isRestore) { // Guardamos una copia de la cuenta en el histórico if (!AccountHistory::addHistory($this->getAccountId(), false)) { $Log->addDescription(_('Error al actualizar el historial')); $Log->writeLog(); return false; } } $query = 'UPDATE accounts SET ' . 'account_pass = :accountPass,' . 'account_IV = :accountIV,' . 'account_userEditId = :accountUserEditId,' . 'account_dateEdit = NOW() ' . 'WHERE account_id = :accountId'; $data['accountPass'] = $this->getAccountPass(); $data['accountIV'] = $this->getAccountIV(); $data['accountUserEditId'] = $this->getAccountUserEditId(); $data['accountId'] = $this->getAccountId(); if (DB::getQuery($query, __FUNCTION__, $data) === false) { return false; } // No escribir en el log ni enviar correos si la actualización es // por cambio de clave maestra o restauración if (!$isMassive && !$isRestore) { $accountInfo = array('customer_name', 'account_name'); $this->getAccountInfoById($accountInfo); $Log->setAction(_('Modificar Clave')); $Log->addDescription(Html::strongText(_('Cliente') . ': ') . $this->_cacheParams['customer_name']); $Log->addDescription(Html::strongText(_('Cuenta') . ': ') . $this->_cacheParams['account_name'] . " (" . $this->getAccountId() . ")"); $Log->writeLog(); Email::sendEmail($Log); } return true; }
/** * Autentificación de usuarios con LDAP. * * @param string $userLogin con el login del usuario * @param string $userPass con la clave del usuario * @return int|bool Número de error o boolean */ public static function authUserLDAP($userLogin, $userPass) { if (!Util::ldapIsAvailable() || !Util::ldapIsEnabled() || !Ldap::checkLDAPParams()) { return false; } $ldapGroupAccess = false; $message['action'] = __FUNCTION__; // Conectamos al servidor realizamos la conexión con el usuario proxy try { Ldap::ldapConnect(); Ldap::ldapBind(); Ldap::getUserDN($userLogin); } catch (\Exception $e) { return false; } $userDN = Ldap::$ldapSearchData[0]['dn']; // Realizamos la conexión con el usuario real y obtenemos los atributos try { Ldap::ldapBind($userDN, $userPass); $attribs = Ldap::getLDAPAttr(); } catch (\Exception $e) { return ldap_errno(Ldap::getConn()); } // Comprobamos si la cuenta está bloqueada o expirada if (isset($attribs['expire']) && $attribs['expire'] > 0) { return 701; } if (Ldap::getLdapGroup() !== '*') { // Comprobamos que el usuario está en el grupo indicado buscando en los atributos del usuario if (isset($attribs['group'])) { if (is_array($attribs['group'])) { foreach ($attribs['group'] as $group) { if (is_int($group)) { continue; } // Comprobamos que el usuario está en el grupo indicado if (self::checkLDAPGroup($group)) { $ldapGroupAccess = true; break; } } } else { $ldapGroupAccess = self::checkLDAPGroup($attribs['group']); } // Comprobamos que el usuario está en el grupo indicado buscando en los atributos del grupo } else { $ldapGroupAccess = Ldap::searchUserInGroup($userDN) || LdapADS::searchADUserInGroup($userLogin); } } else { $ldapGroupAccess = true; } if ($ldapGroupAccess === false) { $log = new Log(__FUNCTION__); $log->addDescription(_('Usuario no pertenece al grupo')); $log->addDescription(sprintf('%s : %s', _('Usuario'), $userDN)); $log->writeLog(); return 702; } self::$userName = isset($attribs['name']) ? $attribs['name'] : $userLogin; self::$userEmail = isset($attribs['mail']) ? $attribs['mail'] : ''; return true; }
$lVideo->addVideo($lYTID, $lYTTitle); } else { Log::writeLog(1, $_SERVER["SCRIPT_NAME"], "Invalid Youtube ID \"$lYTID\""); } } else { Log::writeLog(1, $_SERVER["SCRIPT_NAME"], "Ignoring title \"$lElement->title\""); } } else { Log::writeLog(1, $_SERVER["SCRIPT_NAME"], "Something is wrong with the title or href"); } } } else { Log::writeLog(1, $_SERVER["SCRIPT_NAME"], "Search string to short!"); } echo implode ("," , $gOutRecords); ?> ] }
/** * Método para registar los eventos de BD en el log * * @param $query string La consulta que genera el error * @param $errorMsg string El mensaje de error * @param $errorCode int El código de error */ private static function logDBException($query, $errorMsg, $errorCode, $querySource) { $Log = new Log($querySource); $Log->addDescription($errorMsg . '(' . $errorCode . ')'); $Log->addDescription("SQL: " . self::escape($query)); $Log->writeLog(); error_log($query); error_log($errorMsg); }
/** * Eliminar un grupo. * * @return bool */ public static function deleteGroup() { $groupName = self::getGroupNameById(self::$groupId); $query = 'DELETE FROM usrGroups WHERE usergroup_id = :id LIMIT 1'; $data['id'] = self::$groupId; if (DB::getQuery($query, __FUNCTION__, $data) === false) { return false; } self::$queryLastId = DB::$lastId; $Log = new Log(_('Eliminar Grupo')); if (!Groups::deleteUsersForGroup(self::$groupId)) { $Log->addDescription(_('Error al eliminar los usuarios del grupo')); } $Log->addDescription(sprintf('%s : %s', Html::strongText(_('Grupo')), $groupName)); $Log->writeLog(); Email::sendEmail($Log); return true; }