0 ? '_' . $i : '') . '.' . $ext; $i++; } while (file_exists($dest)); if (!is_dir($basePath . '/' . $subdirectory) && !mkdir($basePath . '/' . $subdirectory)) { return false; } if (!rename($src, $dest)) { return false; } return substr($dest, strlen($basePath . '/')); // Return dest relative to GLPI_PICTURE_DIR } public static function deletePicture($path) { $basePath = GLPI_PLUGIN_DOC_DIR . "/singlesignon"; $fullpath = $basePath . '/' . $path; if (!file_exists($fullpath)) { return false; } $fullpath = realpath($fullpath); if (!static::startsWith($fullpath, realpath($basePath))) { return false; } return @unlink($fullpath); } public static function renderButton($url, $data, $class = 'oauth-login') { $popupClass = ""; if (isset($data['popup']) && $data['popup'] == 1) { $popupClass = "popup"; } $btn = ' 'max-height: 20px;margin-right: 4px', ] ); $btn .= ' '; } $btn .= sprintf(__sso('Login with %s'), $data['name']); $btn .= ''; return $btn; } }