/** * @return void */ protected function login() { $user = new Users(); $data = $user->getById($user->currentUserId()); $cnonce = generateUuid(); $hash = hash('sha256', sprintf("%s:%s:%s", $this->nonce, $cnonce, $data['nzbvortex_api_key']), true); $hash = base64_encode($hash); $params = array('nonce' => $this->nonce, 'cnonce' => $cnonce, 'hash' => $hash); $response = $this->sendRequest('auth/login', $params); if ('successful' == $response['loginResult']) { $this->session = $response['sessionID']; } if ('failed' == $response['loginResult']) { } }
function getClientId() { return $_GET['cid'] == '' ? generateUuid() : $_GET['cid']; }
{ $loader = new Twig_Loader_String(); $twig = new Twig_Environment($loader); $function = new Twig_SimpleFunction('ui', 'uiHelper'); $twig->addFunction($function); return $twig->render($source, $data); } // Iterate theme directories. foreach (globArray($themeDirs) as $themePath) { global $theme; // Load theme configuration. $theme = readJson($themePath); // Add current year for copyrights. $theme['year'] = date('Y'); // Add UUID for sublime themes. $theme['uuid'] = generateUuid($theme['theme']['name']); if (!isset($theme['ui_bg'])) { $theme['ui_bg'] = $theme['background']; } // Include non-hashed colours. $theme = hashLessify($theme); // Iterate patterns. foreach (globArray($patternDirs) as $patternPath) { // This is a good place to show progress. echo '.'; // Load the pattern configuration JSON. $patternConfig = readJson($patternPath); // Build a path to the pattern source. $sourcePath = str_replace('.json', '.pattern', $patternPath); // Load the pattern source from disk. $patternSource = file_get_contents($sourcePath);
public function updatePassword($id, $password) { $db = new DB(); $db->exec(sprintf("update users set password = %s, userseed=md5(%s) where id = %d", $db->escapeString($this->hashPassword($password)), $db->escapeString(generateUuid()), $id)); return Users::SUCCESS; }