@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | __("Session failed to validate (schema version changed)"); |
| 43 | 43 | return false; |
| 44 | 44 | } |
| 45 | - $pdo = Db::pdo(); |
|
| 45 | + $pdo = Db::pdo(); |
|
| 46 | 46 | |
| 47 | 47 | if ($_SESSION["uid"]) { |
| 48 | 48 | |
@@ -56,21 +56,21 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | // user not found |
| 58 | 58 | if ($row = $sth->fetch()) { |
| 59 | - $pwd_hash = $row["pwd_hash"]; |
|
| 59 | + $pwd_hash = $row["pwd_hash"]; |
|
| 60 | 60 | |
| 61 | - if ($pwd_hash != $_SESSION["pwd_hash"]) { |
|
| 61 | + if ($pwd_hash != $_SESSION["pwd_hash"]) { |
|
| 62 | 62 | |
| 63 | - $_SESSION["login_error_msg"] = |
|
| 63 | + $_SESSION["login_error_msg"] = |
|
| 64 | 64 | __("Session failed to validate (password changed)"); |
| 65 | 65 | |
| 66 | - return false; |
|
| 67 | - } |
|
| 66 | + return false; |
|
| 67 | + } |
|
| 68 | 68 | } else { |
| 69 | 69 | |
| 70 | - $_SESSION["login_error_msg"] = |
|
| 71 | - __("Session failed to validate (user not found)"); |
|
| 70 | + $_SESSION["login_error_msg"] = |
|
| 71 | + __("Session failed to validate (user not found)"); |
|
| 72 | 72 | |
| 73 | - return false; |
|
| 73 | + return false; |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -1,44 +1,44 @@ |
||
| 1 | 1 | <?php |
| 2 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
| 3 | - get_include_path()); |
|
| 2 | + set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
| 3 | + get_include_path()); |
|
| 4 | 4 | |
| 5 | - require_once "autoload.php"; |
|
| 6 | - require_once "sessions.php"; |
|
| 7 | - require_once "functions.php"; |
|
| 8 | - require_once "sanity_check.php"; |
|
| 9 | - require_once "config.php"; |
|
| 10 | - require_once "db.php"; |
|
| 11 | - require_once "db-prefs.php"; |
|
| 5 | + require_once "autoload.php"; |
|
| 6 | + require_once "sessions.php"; |
|
| 7 | + require_once "functions.php"; |
|
| 8 | + require_once "sanity_check.php"; |
|
| 9 | + require_once "config.php"; |
|
| 10 | + require_once "db.php"; |
|
| 11 | + require_once "db-prefs.php"; |
|
| 12 | 12 | |
| 13 | - startup_gettext(); |
|
| 13 | + startup_gettext(); |
|
| 14 | 14 | |
| 15 | - $script_started = microtime(true); |
|
| 15 | + $script_started = microtime(true); |
|
| 16 | 16 | |
| 17 | - if (!init_plugins()) return; |
|
| 17 | + if (!init_plugins()) return; |
|
| 18 | 18 | |
| 19 | - if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) { |
|
| 20 | - ob_start("ob_gzhandler"); |
|
| 21 | - } |
|
| 19 | + if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) { |
|
| 20 | + ob_start("ob_gzhandler"); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - $method = $_REQUEST["op"]; |
|
| 23 | + $method = $_REQUEST["op"]; |
|
| 24 | 24 | |
| 25 | - $override = PluginHost::getInstance()->lookup_handler("public", $method); |
|
| 25 | + $override = PluginHost::getInstance()->lookup_handler("public", $method); |
|
| 26 | 26 | |
| 27 | - if ($override) { |
|
| 28 | - $handler = $override; |
|
| 29 | - } else { |
|
| 30 | - $handler = new Handler_Public($_REQUEST); |
|
| 31 | - } |
|
| 27 | + if ($override) { |
|
| 28 | + $handler = $override; |
|
| 29 | + } else { |
|
| 30 | + $handler = new Handler_Public($_REQUEST); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - if (implements_interface($handler, "IHandler") && $handler->before($method)) { |
|
| 34 | - if ($method && method_exists($handler, $method)) { |
|
| 35 | - $handler->$method(); |
|
| 36 | - } else if (method_exists($handler, 'index')) { |
|
| 37 | - $handler->index(); |
|
| 38 | - } |
|
| 39 | - $handler->after(); |
|
| 40 | - return; |
|
| 41 | - } |
|
| 33 | + if (implements_interface($handler, "IHandler") && $handler->before($method)) { |
|
| 34 | + if ($method && method_exists($handler, $method)) { |
|
| 35 | + $handler->$method(); |
|
| 36 | + } else if (method_exists($handler, 'index')) { |
|
| 37 | + $handler->index(); |
|
| 38 | + } |
|
| 39 | + $handler->after(); |
|
| 40 | + return; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - header("Content-Type: text/plain"); |
|
| 44 | - print error_json(13); |
|
| 43 | + header("Content-Type: text/plain"); |
|
| 44 | + print error_json(13); |
|
@@ -1,93 +1,93 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - // This file uses two additional include files: |
|
| 3 | - // |
|
| 4 | - // 1) templates/register_notice.txt - displayed above the registration form |
|
| 5 | - // 2) register_expire_do.php - contains user expiration queries when necessary |
|
| 2 | + // This file uses two additional include files: |
|
| 3 | + // |
|
| 4 | + // 1) templates/register_notice.txt - displayed above the registration form |
|
| 5 | + // 2) register_expire_do.php - contains user expiration queries when necessary |
|
| 6 | 6 | |
| 7 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
| 8 | - get_include_path()); |
|
| 7 | + set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
| 8 | + get_include_path()); |
|
| 9 | 9 | |
| 10 | - require_once "autoload.php"; |
|
| 11 | - require_once "functions.php"; |
|
| 12 | - require_once "sessions.php"; |
|
| 13 | - require_once "sanity_check.php"; |
|
| 14 | - require_once "config.php"; |
|
| 15 | - require_once "db.php"; |
|
| 10 | + require_once "autoload.php"; |
|
| 11 | + require_once "functions.php"; |
|
| 12 | + require_once "sessions.php"; |
|
| 13 | + require_once "sanity_check.php"; |
|
| 14 | + require_once "config.php"; |
|
| 15 | + require_once "db.php"; |
|
| 16 | 16 | |
| 17 | - startup_gettext(); |
|
| 17 | + startup_gettext(); |
|
| 18 | 18 | |
| 19 | - $action = $_REQUEST["action"]; |
|
| 19 | + $action = $_REQUEST["action"]; |
|
| 20 | 20 | |
| 21 | - if (!init_plugins()) return; |
|
| 21 | + if (!init_plugins()) return; |
|
| 22 | 22 | |
| 23 | - if ($_REQUEST["format"] == "feed") { |
|
| 24 | - header("Content-Type: text/xml"); |
|
| 23 | + if ($_REQUEST["format"] == "feed") { |
|
| 24 | + header("Content-Type: text/xml"); |
|
| 25 | 25 | |
| 26 | - print '<?xml version="1.0" encoding="utf-8"?>'; |
|
| 27 | - print "<feed xmlns=\"http://www.w3.org/2005/Atom\"> |
|
| 26 | + print '<?xml version="1.0" encoding="utf-8"?>'; |
|
| 27 | + print "<feed xmlns=\"http://www.w3.org/2005/Atom\"> |
|
| 28 | 28 | <id>".htmlspecialchars(SELF_URL_PATH . "/register.php")."</id> |
| 29 | 29 | <title>Tiny Tiny RSS registration slots</title> |
| 30 | 30 | <link rel=\"self\" href=\"".htmlspecialchars(SELF_URL_PATH . "/register.php?format=feed")."\"/> |
| 31 | 31 | <link rel=\"alternate\" href=\"".htmlspecialchars(SELF_URL_PATH)."\"/>"; |
| 32 | 32 | |
| 33 | - if (ENABLE_REGISTRATION) { |
|
| 34 | - $result = db_query( "SELECT COUNT(*) AS cu FROM ttrss_users"); |
|
| 35 | - $num_users = db_fetch_result($result, 0, "cu"); |
|
| 33 | + if (ENABLE_REGISTRATION) { |
|
| 34 | + $result = db_query( "SELECT COUNT(*) AS cu FROM ttrss_users"); |
|
| 35 | + $num_users = db_fetch_result($result, 0, "cu"); |
|
| 36 | 36 | |
| 37 | - $num_users = REG_MAX_USERS - $num_users; |
|
| 38 | - if ($num_users < 0) $num_users = 0; |
|
| 39 | - $reg_suffix = "enabled"; |
|
| 40 | - } else { |
|
| 41 | - $num_users = 0; |
|
| 42 | - $reg_suffix = "disabled"; |
|
| 43 | - } |
|
| 37 | + $num_users = REG_MAX_USERS - $num_users; |
|
| 38 | + if ($num_users < 0) $num_users = 0; |
|
| 39 | + $reg_suffix = "enabled"; |
|
| 40 | + } else { |
|
| 41 | + $num_users = 0; |
|
| 42 | + $reg_suffix = "disabled"; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - print "<entry> |
|
| 45 | + print "<entry> |
|
| 46 | 46 | <id>".htmlspecialchars(SELF_URL_PATH)."/register.php?$num_users"."</id> |
| 47 | 47 | <link rel=\"alternate\" href=\"".htmlspecialchars(SELF_URL_PATH . "/register.php")."\"/>"; |
| 48 | 48 | |
| 49 | - print "<title>$num_users slots are currently available, registration $reg_suffix</title>"; |
|
| 50 | - print "<summary>$num_users slots are currently available, registration $reg_suffix</summary>"; |
|
| 49 | + print "<title>$num_users slots are currently available, registration $reg_suffix</title>"; |
|
| 50 | + print "<summary>$num_users slots are currently available, registration $reg_suffix</summary>"; |
|
| 51 | 51 | |
| 52 | - print "</entry>"; |
|
| 52 | + print "</entry>"; |
|
| 53 | 53 | |
| 54 | - print "</feed>"; |
|
| 54 | + print "</feed>"; |
|
| 55 | 55 | |
| 56 | - return; |
|
| 57 | - } |
|
| 56 | + return; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /* Remove users which didn't login after receiving their registration information */ |
|
| 59 | + /* Remove users which didn't login after receiving their registration information */ |
|
| 60 | 60 | |
| 61 | - if (DB_TYPE == "pgsql") { |
|
| 62 | - db_query( "DELETE FROM ttrss_users WHERE last_login IS NULL |
|
| 61 | + if (DB_TYPE == "pgsql") { |
|
| 62 | + db_query( "DELETE FROM ttrss_users WHERE last_login IS NULL |
|
| 63 | 63 | AND created < NOW() - INTERVAL '1 day' AND access_level = 0"); |
| 64 | - } else { |
|
| 65 | - db_query( "DELETE FROM ttrss_users WHERE last_login IS NULL |
|
| 64 | + } else { |
|
| 65 | + db_query( "DELETE FROM ttrss_users WHERE last_login IS NULL |
|
| 66 | 66 | AND created < DATE_SUB(NOW(), INTERVAL 1 DAY) AND access_level = 0"); |
| 67 | - } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - if (file_exists("register_expire_do.php")) { |
|
| 70 | - require_once "register_expire_do.php"; |
|
| 71 | - } |
|
| 69 | + if (file_exists("register_expire_do.php")) { |
|
| 70 | + require_once "register_expire_do.php"; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if ($action == "check") { |
|
| 74 | - header("Content-Type: application/xml"); |
|
| 73 | + if ($action == "check") { |
|
| 74 | + header("Content-Type: application/xml"); |
|
| 75 | 75 | |
| 76 | - $login = trim(db_escape_string( $_REQUEST['login'])); |
|
| 76 | + $login = trim(db_escape_string( $_REQUEST['login'])); |
|
| 77 | 77 | |
| 78 | - $result = db_query( "SELECT id FROM ttrss_users WHERE |
|
| 78 | + $result = db_query( "SELECT id FROM ttrss_users WHERE |
|
| 79 | 79 | LOWER(login) = LOWER('$login')"); |
| 80 | 80 | |
| 81 | - $is_registered = db_num_rows($result) > 0; |
|
| 81 | + $is_registered = db_num_rows($result) > 0; |
|
| 82 | 82 | |
| 83 | - print "<result>"; |
|
| 83 | + print "<result>"; |
|
| 84 | 84 | |
| 85 | - printf("%d", $is_registered); |
|
| 85 | + printf("%d", $is_registered); |
|
| 86 | 86 | |
| 87 | - print "</result>"; |
|
| 87 | + print "</result>"; |
|
| 88 | 88 | |
| 89 | - return; |
|
| 90 | - } |
|
| 89 | + return; |
|
| 90 | + } |
|
| 91 | 91 | ?> |
| 92 | 92 | <!DOCTYPE html> |
| 93 | 93 | <html> |
@@ -185,20 +185,20 @@ discard block |
||
| 185 | 185 | <div class="content"> |
| 186 | 186 | |
| 187 | 187 | <?php |
| 188 | - if (!ENABLE_REGISTRATION) { |
|
| 189 | - print_error(__("New user registrations are administratively disabled.")); |
|
| 188 | + if (!ENABLE_REGISTRATION) { |
|
| 189 | + print_error(__("New user registrations are administratively disabled.")); |
|
| 190 | 190 | |
| 191 | - print "<p><form method=\"GET\" action=\"backend.php\"> |
|
| 191 | + print "<p><form method=\"GET\" action=\"backend.php\"> |
|
| 192 | 192 | <input type=\"hidden\" name=\"op\" value=\"logout\"> |
| 193 | 193 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> |
| 194 | 194 | </form>"; |
| 195 | - return; |
|
| 196 | - } |
|
| 195 | + return; |
|
| 196 | + } |
|
| 197 | 197 | ?> |
| 198 | 198 | |
| 199 | 199 | <?php if (REG_MAX_USERS > 0) { |
| 200 | - $result = db_query( "SELECT COUNT(*) AS cu FROM ttrss_users"); |
|
| 201 | - $num_users = db_fetch_result($result, 0, "cu"); |
|
| 200 | + $result = db_query( "SELECT COUNT(*) AS cu FROM ttrss_users"); |
|
| 201 | + $num_users = db_fetch_result($result, 0, "cu"); |
|
| 202 | 202 | } ?> |
| 203 | 203 | |
| 204 | 204 | <?php if (!REG_MAX_USERS || $num_users < REG_MAX_USERS) { ?> |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | <!-- If you have any rules or ToS you'd like to display, enter them here --> |
| 207 | 207 | |
| 208 | 208 | <?php if (file_exists("templates/register_notice.txt")) { |
| 209 | - require_once "templates/register_notice.txt"; |
|
| 210 | - } ?> |
|
| 209 | + require_once "templates/register_notice.txt"; |
|
| 210 | + } ?> |
|
| 211 | 211 | |
| 212 | 212 | <?php if (!$action) { ?> |
| 213 | 213 | |
@@ -241,110 +241,110 @@ discard block |
||
| 241 | 241 | <?php } else if ($action == "do_register") { ?> |
| 242 | 242 | |
| 243 | 243 | <?php |
| 244 | - $login = mb_strtolower(trim(db_escape_string( $_REQUEST["login"]))); |
|
| 245 | - $email = trim(db_escape_string( $_REQUEST["email"])); |
|
| 246 | - $test = trim(db_escape_string( $_REQUEST["turing_test"])); |
|
| 244 | + $login = mb_strtolower(trim(db_escape_string( $_REQUEST["login"]))); |
|
| 245 | + $email = trim(db_escape_string( $_REQUEST["email"])); |
|
| 246 | + $test = trim(db_escape_string( $_REQUEST["turing_test"])); |
|
| 247 | 247 | |
| 248 | - if (!$login || !$email || !$test) { |
|
| 249 | - print_error(__("Your registration information is incomplete.")); |
|
| 250 | - print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 248 | + if (!$login || !$email || !$test) { |
|
| 249 | + print_error(__("Your registration information is incomplete.")); |
|
| 250 | + print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 251 | 251 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> |
| 252 | 252 | </form>"; |
| 253 | - return; |
|
| 254 | - } |
|
| 253 | + return; |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - if ($test == "four" || $test == "4") { |
|
| 256 | + if ($test == "four" || $test == "4") { |
|
| 257 | 257 | |
| 258 | - $result = db_query( "SELECT id FROM ttrss_users WHERE |
|
| 258 | + $result = db_query( "SELECT id FROM ttrss_users WHERE |
|
| 259 | 259 | login = '$login'"); |
| 260 | 260 | |
| 261 | - $is_registered = db_num_rows($result) > 0; |
|
| 261 | + $is_registered = db_num_rows($result) > 0; |
|
| 262 | 262 | |
| 263 | - if ($is_registered) { |
|
| 264 | - print_error(__('Sorry, this username is already taken.')); |
|
| 265 | - print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 263 | + if ($is_registered) { |
|
| 264 | + print_error(__('Sorry, this username is already taken.')); |
|
| 265 | + print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 266 | 266 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> |
| 267 | 267 | </form>"; |
| 268 | - } else { |
|
| 268 | + } else { |
|
| 269 | 269 | |
| 270 | - $password = make_password(); |
|
| 270 | + $password = make_password(); |
|
| 271 | 271 | |
| 272 | - $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
|
| 273 | - $pwd_hash = encrypt_password($password, $salt, true); |
|
| 272 | + $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
|
| 273 | + $pwd_hash = encrypt_password($password, $salt, true); |
|
| 274 | 274 | |
| 275 | - db_query( "INSERT INTO ttrss_users |
|
| 275 | + db_query( "INSERT INTO ttrss_users |
|
| 276 | 276 | (login,pwd_hash,access_level,last_login, email, created, salt) |
| 277 | 277 | VALUES ('$login', '$pwd_hash', 0, null, '$email', NOW(), '$salt')"); |
| 278 | 278 | |
| 279 | - $result = db_query( "SELECT id FROM ttrss_users WHERE |
|
| 279 | + $result = db_query( "SELECT id FROM ttrss_users WHERE |
|
| 280 | 280 | login = '$login' AND pwd_hash = '$pwd_hash'"); |
| 281 | 281 | |
| 282 | - if (db_num_rows($result) != 1) { |
|
| 283 | - print_error(__('Registration failed.')); |
|
| 284 | - print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 282 | + if (db_num_rows($result) != 1) { |
|
| 283 | + print_error(__('Registration failed.')); |
|
| 284 | + print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 285 | 285 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> |
| 286 | 286 | </form>"; |
| 287 | - } else { |
|
| 288 | - |
|
| 289 | - $new_uid = db_fetch_result($result, 0, "id"); |
|
| 290 | - |
|
| 291 | - initialize_user( $new_uid); |
|
| 292 | - |
|
| 293 | - $reg_text = "Hi!\n". |
|
| 294 | - "\n". |
|
| 295 | - "You are receiving this message, because you (or somebody else) have opened\n". |
|
| 296 | - "an account at Tiny Tiny RSS.\n". |
|
| 297 | - "\n". |
|
| 298 | - "Your login information is as follows:\n". |
|
| 299 | - "\n". |
|
| 300 | - "Login: $login\n". |
|
| 301 | - "Password: $password\n". |
|
| 302 | - "\n". |
|
| 303 | - "Don't forget to login at least once to your new account, otherwise\n". |
|
| 304 | - "it will be deleted in 24 hours.\n". |
|
| 305 | - "\n". |
|
| 306 | - "If that wasn't you, just ignore this message. Thanks."; |
|
| 307 | - |
|
| 308 | - $mailer = new Mailer(); |
|
| 309 | - $rc = $mailer->mail(["to_address" => $email, |
|
| 310 | - "subject" => "Registration information for Tiny Tiny RSS", |
|
| 311 | - "message" => $reg_text]); |
|
| 312 | - |
|
| 313 | - if (!$rc) print_error($mailer->error()); |
|
| 314 | - |
|
| 315 | - $reg_text = "Hi!\n". |
|
| 316 | - "\n". |
|
| 317 | - "New user had registered at your Tiny Tiny RSS installation.\n". |
|
| 318 | - "\n". |
|
| 319 | - "Login: $login\n". |
|
| 320 | - "Email: $email\n"; |
|
| 321 | - |
|
| 322 | - $mailer = new Mailer(); |
|
| 323 | - $rc = $mailer->mail(["to_address" => REG_NOTIFY_ADDRESS, |
|
| 324 | - "subject" => "Registration notice for Tiny Tiny RSS", |
|
| 325 | - "message" => $reg_text]); |
|
| 326 | - |
|
| 327 | - if (!$rc) print_error($mailer->error()); |
|
| 328 | - |
|
| 329 | - print_notice(__("Account created successfully.")); |
|
| 330 | - |
|
| 331 | - print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 287 | + } else { |
|
| 288 | + |
|
| 289 | + $new_uid = db_fetch_result($result, 0, "id"); |
|
| 290 | + |
|
| 291 | + initialize_user( $new_uid); |
|
| 292 | + |
|
| 293 | + $reg_text = "Hi!\n". |
|
| 294 | + "\n". |
|
| 295 | + "You are receiving this message, because you (or somebody else) have opened\n". |
|
| 296 | + "an account at Tiny Tiny RSS.\n". |
|
| 297 | + "\n". |
|
| 298 | + "Your login information is as follows:\n". |
|
| 299 | + "\n". |
|
| 300 | + "Login: $login\n". |
|
| 301 | + "Password: $password\n". |
|
| 302 | + "\n". |
|
| 303 | + "Don't forget to login at least once to your new account, otherwise\n". |
|
| 304 | + "it will be deleted in 24 hours.\n". |
|
| 305 | + "\n". |
|
| 306 | + "If that wasn't you, just ignore this message. Thanks."; |
|
| 307 | + |
|
| 308 | + $mailer = new Mailer(); |
|
| 309 | + $rc = $mailer->mail(["to_address" => $email, |
|
| 310 | + "subject" => "Registration information for Tiny Tiny RSS", |
|
| 311 | + "message" => $reg_text]); |
|
| 312 | + |
|
| 313 | + if (!$rc) print_error($mailer->error()); |
|
| 314 | + |
|
| 315 | + $reg_text = "Hi!\n". |
|
| 316 | + "\n". |
|
| 317 | + "New user had registered at your Tiny Tiny RSS installation.\n". |
|
| 318 | + "\n". |
|
| 319 | + "Login: $login\n". |
|
| 320 | + "Email: $email\n"; |
|
| 321 | + |
|
| 322 | + $mailer = new Mailer(); |
|
| 323 | + $rc = $mailer->mail(["to_address" => REG_NOTIFY_ADDRESS, |
|
| 324 | + "subject" => "Registration notice for Tiny Tiny RSS", |
|
| 325 | + "message" => $reg_text]); |
|
| 326 | + |
|
| 327 | + if (!$rc) print_error($mailer->error()); |
|
| 328 | + |
|
| 329 | + print_notice(__("Account created successfully.")); |
|
| 330 | + |
|
| 331 | + print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 332 | 332 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> |
| 333 | 333 | </form>"; |
| 334 | 334 | |
| 335 | - } |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | - } |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | - } else { |
|
| 340 | - print_error('Plese check the form again, you have failed the robot test.'); |
|
| 341 | - print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 339 | + } else { |
|
| 340 | + print_error('Plese check the form again, you have failed the robot test.'); |
|
| 341 | + print "<p><form method=\"GET\" action=\"index.php\"> |
|
| 342 | 342 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> |
| 343 | 343 | </form>"; |
| 344 | 344 | |
| 345 | - } |
|
| 346 | - } |
|
| 347 | - ?> |
|
| 345 | + } |
|
| 346 | + } |
|
| 347 | + ?> |
|
| 348 | 348 | |
| 349 | 349 | <?php } else { ?> |
| 350 | 350 | |
@@ -1,35 +1,35 @@ |
||
| 1 | 1 | <?php |
| 2 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
| 3 | - get_include_path()); |
|
| 2 | + set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
| 3 | + get_include_path()); |
|
| 4 | 4 | |
| 5 | - require_once "autoload.php"; |
|
| 6 | - require_once "functions.php"; |
|
| 7 | - require_once "sessions.php"; |
|
| 8 | - require_once "sanity_check.php"; |
|
| 9 | - require_once "config.php"; |
|
| 10 | - require_once "db.php"; |
|
| 11 | - require_once "db-prefs.php"; |
|
| 5 | + require_once "autoload.php"; |
|
| 6 | + require_once "functions.php"; |
|
| 7 | + require_once "sessions.php"; |
|
| 8 | + require_once "sanity_check.php"; |
|
| 9 | + require_once "config.php"; |
|
| 10 | + require_once "db.php"; |
|
| 11 | + require_once "db-prefs.php"; |
|
| 12 | 12 | |
| 13 | - if (!init_plugins()) return; |
|
| 13 | + if (!init_plugins()) return; |
|
| 14 | 14 | |
| 15 | - $op = $_REQUEST['op']; |
|
| 15 | + $op = $_REQUEST['op']; |
|
| 16 | 16 | |
| 17 | - if ($op == "publish"){ |
|
| 18 | - $key = $_REQUEST["key"]; |
|
| 19 | - $pdo = Db::pdo(); |
|
| 17 | + if ($op == "publish"){ |
|
| 18 | + $key = $_REQUEST["key"]; |
|
| 19 | + $pdo = Db::pdo(); |
|
| 20 | 20 | |
| 21 | - $sth = $pdo->prepare( "SELECT owner_uid |
|
| 21 | + $sth = $pdo->prepare( "SELECT owner_uid |
|
| 22 | 22 | FROM ttrss_access_keys WHERE |
| 23 | 23 | access_key = ? AND feed_id = 'OPML:Publish'"); |
| 24 | - $sth->execute([$key]); |
|
| 24 | + $sth->execute([$key]); |
|
| 25 | 25 | |
| 26 | - if ($row = $sth->fetch()) { |
|
| 27 | - $owner_uid = $row['owner_uid']; |
|
| 26 | + if ($row = $sth->fetch()) { |
|
| 27 | + $owner_uid = $row['owner_uid']; |
|
| 28 | 28 | |
| 29 | - $opml = new Opml($_REQUEST); |
|
| 30 | - $opml->opml_export("", $owner_uid, true, false); |
|
| 29 | + $opml = new Opml($_REQUEST); |
|
| 30 | + $opml->opml_export("", $owner_uid, true, false); |
|
| 31 | 31 | |
| 32 | - } else { |
|
| 33 | - print "<error>User not found</error>"; |
|
| 34 | - } |
|
| 35 | - } |
|
| 32 | + } else { |
|
| 33 | + print "<error>User not found</error>"; |
|
| 34 | + } |
|
| 35 | + } |
|
@@ -14,4 +14,4 @@ |
||
| 14 | 14 | define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false
|
| 15 | 15 | |
| 16 | 16 | define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images
|
| 17 | - |
|
| 18 | 17 | \ No newline at end of file |
| 18 | + |
|
| 19 | 19 | \ No newline at end of file |
@@ -1,64 +1,64 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | class NSFW extends Plugin { |
| 3 | - private $host; |
|
| 3 | + private $host; |
|
| 4 | 4 | |
| 5 | - public function about() { |
|
| 6 | - return array(1.0, |
|
| 7 | - "Hide article content based on tags", |
|
| 8 | - "fox", |
|
| 9 | - false); |
|
| 10 | - } |
|
| 5 | + public function about() { |
|
| 6 | + return array(1.0, |
|
| 7 | + "Hide article content based on tags", |
|
| 8 | + "fox", |
|
| 9 | + false); |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | - public function init($host) { |
|
| 13 | - $this->host = $host; |
|
| 12 | + public function init($host) { |
|
| 13 | + $this->host = $host; |
|
| 14 | 14 | |
| 15 | - $host->add_hook($host::HOOK_RENDER_ARTICLE, $this); |
|
| 16 | - $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this); |
|
| 17 | - $host->add_hook($host::HOOK_PREFS_TAB, $this); |
|
| 15 | + $host->add_hook($host::HOOK_RENDER_ARTICLE, $this); |
|
| 16 | + $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this); |
|
| 17 | + $host->add_hook($host::HOOK_PREFS_TAB, $this); |
|
| 18 | 18 | |
| 19 | - } |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function get_js() { |
|
| 22 | - return file_get_contents(dirname(__FILE__) . "/init.js"); |
|
| 23 | - } |
|
| 21 | + public function get_js() { |
|
| 22 | + return file_get_contents(dirname(__FILE__) . "/init.js"); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function hook_render_article($article) { |
|
| 26 | - $tags = array_map("trim", explode(",", $this->host->get($this, "tags"))); |
|
| 27 | - $a_tags = array_map("trim", explode(",", $article["tag_cache"])); |
|
| 25 | + public function hook_render_article($article) { |
|
| 26 | + $tags = array_map("trim", explode(",", $this->host->get($this, "tags"))); |
|
| 27 | + $a_tags = array_map("trim", explode(",", $article["tag_cache"])); |
|
| 28 | 28 | |
| 29 | - if (count(array_intersect($tags, $a_tags)) > 0) { |
|
| 30 | - $article["content"] = "<div class='nswf wrapper'><button onclick=\"nsfwShow(this)\">".__("Not work safe (click to toggle)")."</button> |
|
| 29 | + if (count(array_intersect($tags, $a_tags)) > 0) { |
|
| 30 | + $article["content"] = "<div class='nswf wrapper'><button onclick=\"nsfwShow(this)\">".__("Not work safe (click to toggle)")."</button> |
|
| 31 | 31 | <div class='nswf content' style='display : none'>".$article["content"]."</div></div>"; |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - return $article; |
|
| 35 | - } |
|
| 34 | + return $article; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - public function hook_render_article_cdm($article) { |
|
| 38 | - $tags = array_map("trim", explode(",", $this->host->get($this, "tags"))); |
|
| 39 | - $a_tags = array_map("trim", explode(",", $article["tag_cache"])); |
|
| 37 | + public function hook_render_article_cdm($article) { |
|
| 38 | + $tags = array_map("trim", explode(",", $this->host->get($this, "tags"))); |
|
| 39 | + $a_tags = array_map("trim", explode(",", $article["tag_cache"])); |
|
| 40 | 40 | |
| 41 | - if (count(array_intersect($tags, $a_tags)) > 0) { |
|
| 42 | - $article["content"] = "<div class='nswf wrapper'><button onclick=\"nsfwShow(this)\">".__("Not work safe (click to toggle)")."</button> |
|
| 41 | + if (count(array_intersect($tags, $a_tags)) > 0) { |
|
| 42 | + $article["content"] = "<div class='nswf wrapper'><button onclick=\"nsfwShow(this)\">".__("Not work safe (click to toggle)")."</button> |
|
| 43 | 43 | <div class='nswf content' style='display : none'>".$article["content"]."</div></div>"; |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - return $article; |
|
| 47 | - } |
|
| 46 | + return $article; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function hook_prefs_tab($args) { |
|
| 50 | - if ($args != "prefPrefs") return; |
|
| 49 | + public function hook_prefs_tab($args) { |
|
| 50 | + if ($args != "prefPrefs") return; |
|
| 51 | 51 | |
| 52 | - print "<div dojoType=\"dijit.layout.AccordionPane\" |
|
| 52 | + print "<div dojoType=\"dijit.layout.AccordionPane\" |
|
| 53 | 53 | title=\"<i class='material-icons'>extension</i> ".__("NSFW Plugin")."\">"; |
| 54 | 54 | |
| 55 | - print "<br/>"; |
|
| 55 | + print "<br/>"; |
|
| 56 | 56 | |
| 57 | - $tags = $this->host->get($this, "tags"); |
|
| 57 | + $tags = $this->host->get($this, "tags"); |
|
| 58 | 58 | |
| 59 | - print "<form dojoType=\"dijit.form.Form\">"; |
|
| 59 | + print "<form dojoType=\"dijit.form.Form\">"; |
|
| 60 | 60 | |
| 61 | - print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\"> |
|
| 61 | + print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\"> |
|
| 62 | 62 | evt.preventDefault(); |
| 63 | 63 | if (this.validate()) { |
| 64 | 64 | new Ajax.Request('backend.php', { |
@@ -71,38 +71,38 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | </script>"; |
| 73 | 73 | |
| 74 | - print_hidden("op", "pluginhandler"); |
|
| 75 | - print_hidden("method", "save"); |
|
| 76 | - print_hidden("plugin", "nsfw"); |
|
| 74 | + print_hidden("op", "pluginhandler"); |
|
| 75 | + print_hidden("method", "save"); |
|
| 76 | + print_hidden("plugin", "nsfw"); |
|
| 77 | 77 | |
| 78 | - print "<table width=\"100%\" class=\"prefPrefsList\">"; |
|
| 78 | + print "<table width=\"100%\" class=\"prefPrefsList\">"; |
|
| 79 | 79 | |
| 80 | - print "<tr><td width=\"40%\">".__("Tags to consider NSFW (comma-separated)")."</td>"; |
|
| 81 | - print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"tags\" value=\"$tags\"></td></tr>"; |
|
| 80 | + print "<tr><td width=\"40%\">".__("Tags to consider NSFW (comma-separated)")."</td>"; |
|
| 81 | + print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"tags\" value=\"$tags\"></td></tr>"; |
|
| 82 | 82 | |
| 83 | - print "</table>"; |
|
| 83 | + print "</table>"; |
|
| 84 | 84 | |
| 85 | - print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">". |
|
| 86 | - __("Save")."</button>"; |
|
| 85 | + print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">". |
|
| 86 | + __("Save")."</button>"; |
|
| 87 | 87 | |
| 88 | - print "</form>"; |
|
| 88 | + print "</form>"; |
|
| 89 | 89 | |
| 90 | - print "</div>"; #pane |
|
| 91 | - } |
|
| 90 | + print "</div>"; #pane |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - public function save() { |
|
| 94 | - $tags = explode(",", $_POST["tags"]); |
|
| 95 | - $tags = array_map("trim", $tags); |
|
| 96 | - $tags = array_map("mb_strtolower", $tags); |
|
| 97 | - $tags = join(", ", $tags); |
|
| 93 | + public function save() { |
|
| 94 | + $tags = explode(",", $_POST["tags"]); |
|
| 95 | + $tags = array_map("trim", $tags); |
|
| 96 | + $tags = array_map("mb_strtolower", $tags); |
|
| 97 | + $tags = join(", ", $tags); |
|
| 98 | 98 | |
| 99 | - $this->host->set($this, "tags", $tags); |
|
| 99 | + $this->host->set($this, "tags", $tags); |
|
| 100 | 100 | |
| 101 | - echo __("Configuration saved."); |
|
| 102 | - } |
|
| 101 | + echo __("Configuration saved."); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - public function api_version() { |
|
| 105 | - return 2; |
|
| 106 | - } |
|
| 104 | + public function api_version() { |
|
| 105 | + return 2; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | } |
@@ -1,88 +1,88 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Auth_Remote extends Plugin implements IAuthModule { |
| 3 | 3 | |
| 4 | - private $host; |
|
| 5 | - /* @var Auth_Base $base */ |
|
| 6 | - private $base; |
|
| 7 | - |
|
| 8 | - public function about() { |
|
| 9 | - return array(1.0, |
|
| 10 | - "Authenticates against remote password (e.g. supplied by Apache)", |
|
| 11 | - "fox", |
|
| 12 | - true); |
|
| 13 | - } |
|
| 14 | - |
|
| 15 | - /* @var PluginHost $host */ |
|
| 16 | - public function init($host ) { |
|
| 17 | - $this->host = $host; |
|
| 18 | - $this->base = new Auth_Base(); |
|
| 19 | - |
|
| 20 | - $host->add_hook($host::HOOK_AUTH_USER, $this); |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - public function get_login_by_ssl_certificate() { |
|
| 24 | - $cert_serial = get_ssl_certificate_id(); |
|
| 25 | - |
|
| 26 | - if ($cert_serial) { |
|
| 27 | - $sth = $this->pdo->prepare("SELECT login FROM ttrss_user_prefs, ttrss_users |
|
| 4 | + private $host; |
|
| 5 | + /* @var Auth_Base $base */ |
|
| 6 | + private $base; |
|
| 7 | + |
|
| 8 | + public function about() { |
|
| 9 | + return array(1.0, |
|
| 10 | + "Authenticates against remote password (e.g. supplied by Apache)", |
|
| 11 | + "fox", |
|
| 12 | + true); |
|
| 13 | + } |
|
| 14 | + |
|
| 15 | + /* @var PluginHost $host */ |
|
| 16 | + public function init($host ) { |
|
| 17 | + $this->host = $host; |
|
| 18 | + $this->base = new Auth_Base(); |
|
| 19 | + |
|
| 20 | + $host->add_hook($host::HOOK_AUTH_USER, $this); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + public function get_login_by_ssl_certificate() { |
|
| 24 | + $cert_serial = get_ssl_certificate_id(); |
|
| 25 | + |
|
| 26 | + if ($cert_serial) { |
|
| 27 | + $sth = $this->pdo->prepare("SELECT login FROM ttrss_user_prefs, ttrss_users |
|
| 28 | 28 | WHERE pref_name = 'SSL_CERT_SERIAL' AND value = ? AND |
| 29 | 29 | owner_uid = ttrss_users.id"); |
| 30 | - $sth->execute([$cert_serial]); |
|
| 31 | - |
|
| 32 | - if ($row = $sth->fetch()) { |
|
| 33 | - return $row['login']; |
|
| 34 | - } |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - return ""; |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
| 42 | - */ |
|
| 43 | - public function authenticate($login, $password) { |
|
| 44 | - $try_login = $_SERVER["REMOTE_USER"]; |
|
| 45 | - |
|
| 46 | - // php-cgi |
|
| 47 | - if (!$try_login) $try_login = $_SERVER["REDIRECT_REMOTE_USER"]; |
|
| 48 | - if (!$try_login) $try_login = $_SERVER["PHP_AUTH_USER"]; |
|
| 49 | - |
|
| 50 | - if (!$try_login) $try_login = $this->get_login_by_ssl_certificate(); |
|
| 51 | - |
|
| 52 | - if ($try_login) { |
|
| 53 | - $user_id = $this->base->auto_create_user($try_login, $password); |
|
| 54 | - |
|
| 55 | - if ($user_id) { |
|
| 56 | - $_SESSION["fake_login"] = $try_login; |
|
| 57 | - $_SESSION["fake_password"] = "******"; |
|
| 58 | - $_SESSION["hide_hello"] = true; |
|
| 59 | - $_SESSION["hide_logout"] = true; |
|
| 60 | - |
|
| 61 | - // LemonLDAP can send user informations via HTTP HEADER |
|
| 62 | - if (defined('AUTH_AUTO_CREATE') && AUTH_AUTO_CREATE){ |
|
| 63 | - // update user name |
|
| 64 | - $fullname = $_SERVER['HTTP_USER_NAME'] ? $_SERVER['HTTP_USER_NAME'] : $_SERVER['AUTHENTICATE_CN']; |
|
| 65 | - if ($fullname){ |
|
| 66 | - $sth = $this->pdo->prepare("UPDATE ttrss_users SET full_name = ? WHERE id = ?"); |
|
| 67 | - $sth->execute([$fullname, $user_id]); |
|
| 68 | - } |
|
| 69 | - // update user mail |
|
| 70 | - $email = $_SERVER['HTTP_USER_MAIL'] ? $_SERVER['HTTP_USER_MAIL'] : $_SERVER['AUTHENTICATE_MAIL']; |
|
| 71 | - if ($email){ |
|
| 72 | - $sth = $this->pdo->prepare("UPDATE ttrss_users SET email = ? WHERE id = ?"); |
|
| 73 | - $sth->execute([$email, $user_id]); |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - return $user_id; |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - return false; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - public function api_version() { |
|
| 85 | - return 2; |
|
| 86 | - } |
|
| 30 | + $sth->execute([$cert_serial]); |
|
| 31 | + |
|
| 32 | + if ($row = $sth->fetch()) { |
|
| 33 | + return $row['login']; |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + return ""; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
| 42 | + */ |
|
| 43 | + public function authenticate($login, $password) { |
|
| 44 | + $try_login = $_SERVER["REMOTE_USER"]; |
|
| 45 | + |
|
| 46 | + // php-cgi |
|
| 47 | + if (!$try_login) $try_login = $_SERVER["REDIRECT_REMOTE_USER"]; |
|
| 48 | + if (!$try_login) $try_login = $_SERVER["PHP_AUTH_USER"]; |
|
| 49 | + |
|
| 50 | + if (!$try_login) $try_login = $this->get_login_by_ssl_certificate(); |
|
| 51 | + |
|
| 52 | + if ($try_login) { |
|
| 53 | + $user_id = $this->base->auto_create_user($try_login, $password); |
|
| 54 | + |
|
| 55 | + if ($user_id) { |
|
| 56 | + $_SESSION["fake_login"] = $try_login; |
|
| 57 | + $_SESSION["fake_password"] = "******"; |
|
| 58 | + $_SESSION["hide_hello"] = true; |
|
| 59 | + $_SESSION["hide_logout"] = true; |
|
| 60 | + |
|
| 61 | + // LemonLDAP can send user informations via HTTP HEADER |
|
| 62 | + if (defined('AUTH_AUTO_CREATE') && AUTH_AUTO_CREATE){ |
|
| 63 | + // update user name |
|
| 64 | + $fullname = $_SERVER['HTTP_USER_NAME'] ? $_SERVER['HTTP_USER_NAME'] : $_SERVER['AUTHENTICATE_CN']; |
|
| 65 | + if ($fullname){ |
|
| 66 | + $sth = $this->pdo->prepare("UPDATE ttrss_users SET full_name = ? WHERE id = ?"); |
|
| 67 | + $sth->execute([$fullname, $user_id]); |
|
| 68 | + } |
|
| 69 | + // update user mail |
|
| 70 | + $email = $_SERVER['HTTP_USER_MAIL'] ? $_SERVER['HTTP_USER_MAIL'] : $_SERVER['AUTHENTICATE_MAIL']; |
|
| 71 | + if ($email){ |
|
| 72 | + $sth = $this->pdo->prepare("UPDATE ttrss_users SET email = ? WHERE id = ?"); |
|
| 73 | + $sth->execute([$email, $user_id]); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + return $user_id; |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + return false; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + public function api_version() { |
|
| 85 | + return 2; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | } |
@@ -1,30 +1,30 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Swap_JK extends Plugin { |
| 3 | 3 | |
| 4 | - private $host; |
|
| 4 | + private $host; |
|
| 5 | 5 | |
| 6 | - public function about() { |
|
| 7 | - return array(1.0, |
|
| 8 | - "Swap j and k hotkeys (for vi brethren)", |
|
| 9 | - "fox"); |
|
| 10 | - } |
|
| 6 | + public function about() { |
|
| 7 | + return array(1.0, |
|
| 8 | + "Swap j and k hotkeys (for vi brethren)", |
|
| 9 | + "fox"); |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | - public function init($host) { |
|
| 13 | - $this->host = $host; |
|
| 12 | + public function init($host) { |
|
| 13 | + $this->host = $host; |
|
| 14 | 14 | |
| 15 | - $host->add_hook($host::HOOK_HOTKEY_MAP, $this); |
|
| 16 | - } |
|
| 15 | + $host->add_hook($host::HOOK_HOTKEY_MAP, $this); |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function hook_hotkey_map($hotkeys) { |
|
| 18 | + public function hook_hotkey_map($hotkeys) { |
|
| 19 | 19 | |
| 20 | - $hotkeys["j"] = "next_feed"; |
|
| 21 | - $hotkeys["k"] = "prev_feed"; |
|
| 20 | + $hotkeys["j"] = "next_feed"; |
|
| 21 | + $hotkeys["k"] = "prev_feed"; |
|
| 22 | 22 | |
| 23 | - return $hotkeys; |
|
| 24 | - } |
|
| 23 | + return $hotkeys; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public function api_version() { |
|
| 27 | - return 2; |
|
| 28 | - } |
|
| 26 | + public function api_version() { |
|
| 27 | + return 2; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | } |
@@ -1,56 +1,56 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Bookmarklets extends Plugin { |
| 3 | - private $host; |
|
| 3 | + private $host; |
|
| 4 | 4 | |
| 5 | - function about() { |
|
| 5 | + function about() { |
|
| 6 | 6 | return array(1.0, |
| 7 | - "Easy feed subscription and web page sharing using bookmarklets", |
|
| 8 | - "fox", |
|
| 9 | - false, |
|
| 10 | - "https://git.tt-rss.org/fox/tt-rss/wiki/ShareAnything"); |
|
| 11 | - } |
|
| 7 | + "Easy feed subscription and web page sharing using bookmarklets", |
|
| 8 | + "fox", |
|
| 9 | + false, |
|
| 10 | + "https://git.tt-rss.org/fox/tt-rss/wiki/ShareAnything"); |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - function init($host) { |
|
| 13 | + function init($host) { |
|
| 14 | 14 | $this->host = $host; |
| 15 | 15 | |
| 16 | 16 | $host->add_hook($host::HOOK_PREFS_TAB, $this); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - function hook_prefs_tab($args) { |
|
| 19 | + function hook_prefs_tab($args) { |
|
| 20 | 20 | if ($args == "prefFeeds") { |
| 21 | 21 | |
| 22 | - print "<div dojoType=\"dijit.layout.AccordionPane\" |
|
| 22 | + print "<div dojoType=\"dijit.layout.AccordionPane\" |
|
| 23 | 23 | title=\"<i class='material-icons'>bookmark</i> ".__('Bookmarklets')."\">"; |
| 24 | 24 | |
| 25 | - print "<h3>" . __("Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it.") . "</h3>"; |
|
| 25 | + print "<h3>" . __("Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it.") . "</h3>"; |
|
| 26 | 26 | |
| 27 | - $bm_subscribe_url = str_replace('%s', '', Pref_Feeds::subscribe_to_feed_url()); |
|
| 27 | + $bm_subscribe_url = str_replace('%s', '', Pref_Feeds::subscribe_to_feed_url()); |
|
| 28 | 28 | |
| 29 | - $confirm_str = str_replace("'", "\'", __('Subscribe to %s in Tiny Tiny RSS?')); |
|
| 29 | + $confirm_str = str_replace("'", "\'", __('Subscribe to %s in Tiny Tiny RSS?')); |
|
| 30 | 30 | |
| 31 | - $bm_url = htmlspecialchars("javascript:{if(confirm('$confirm_str'.replace('%s',window.location.href)))window.location.href='$bm_subscribe_url'+window.location.href}"); |
|
| 31 | + $bm_url = htmlspecialchars("javascript:{if(confirm('$confirm_str'.replace('%s',window.location.href)))window.location.href='$bm_subscribe_url'+window.location.href}"); |
|
| 32 | 32 | |
| 33 | - print "<p><label class='dijitButton'>"; |
|
| 34 | - print "<a href=\"$bm_url\">" . __('Subscribe in Tiny Tiny RSS'). "</a>"; |
|
| 35 | - print "</label></p>"; |
|
| 33 | + print "<p><label class='dijitButton'>"; |
|
| 34 | + print "<a href=\"$bm_url\">" . __('Subscribe in Tiny Tiny RSS'). "</a>"; |
|
| 35 | + print "</label></p>"; |
|
| 36 | 36 | |
| 37 | - print "<h3>" . __("Use this bookmarklet to publish arbitrary pages using Tiny Tiny RSS") . "</h3>"; |
|
| 37 | + print "<h3>" . __("Use this bookmarklet to publish arbitrary pages using Tiny Tiny RSS") . "</h3>"; |
|
| 38 | 38 | |
| 39 | - print "<label class='dijitButton'>"; |
|
| 40 | - $bm_url = htmlspecialchars("javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='".get_self_url_prefix()."/public.php?op=sharepopup',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=500,height=250')){l.href=g;}}a();})()"); |
|
| 41 | - print "<a href=\"$bm_url\">" . __('Share with Tiny Tiny RSS'). "</a>"; |
|
| 42 | - print "</label>"; |
|
| 39 | + print "<label class='dijitButton'>"; |
|
| 40 | + $bm_url = htmlspecialchars("javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='".get_self_url_prefix()."/public.php?op=sharepopup',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=500,height=250')){l.href=g;}}a();})()"); |
|
| 41 | + print "<a href=\"$bm_url\">" . __('Share with Tiny Tiny RSS'). "</a>"; |
|
| 42 | + print "</label>"; |
|
| 43 | 43 | |
| 44 | - print "<button dojoType='dijit.form.Button' class='alt-info' onclick='window.open(\"https://tt-rss.org/wiki/ShareAnything\")'> |
|
| 44 | + print "<button dojoType='dijit.form.Button' class='alt-info' onclick='window.open(\"https://tt-rss.org/wiki/ShareAnything\")'> |
|
| 45 | 45 | <i class='material-icons'>help</i> ".__("More info...")."</button>"; |
| 46 | 46 | |
| 47 | - print "</div>"; #pane |
|
| 47 | + print "</div>"; #pane |
|
| 48 | 48 | |
| 49 | - } |
|
| 50 | - } |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - public function api_version() { |
|
| 53 | - return 2; |
|
| 54 | - } |
|
| 52 | + public function api_version() { |
|
| 53 | + return 2; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | } |