{"action":"created","comment":{"url":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/comments/48167243","id":48167243,"diff_hunk":"@@ -0,0 +1,294 @@\n+<?php\n+/**\n+ *\n+ * Ideas extension for the phpBB Forum Software package.\n+ *\n+ * @copyright (c) phpBB Limited <https://www.phpbb.com>\n+ * @license GNU General Public License, version 2 (GPL-2.0)\n+ *\n+ */\n+\n+namespace phpbb\\ideas\\controller;\n+\n+/**\n+ * Admin controller\n+ */\n+class admin_controller\n+{\n+\t/** @var \\phpbb\\config\\config */\n+\tprotected $config;\n+\n+\t/** @var \\phpbb\\db\\driver\\driver_interface */\n+\tprotected $db;\n+\n+\t/** @var \\phpbb\\language\\language */\n+\tprotected $language;\n+\n+\t/** @var \\phpbb\\log\\log */\n+\tprotected $log;\n+\n+\t/** @var \\phpbb\\request\\request */\n+\tprotected $request;\n+\n+\t/** @var \\phpbb\\template\\template */\n+\tprotected $template;\n+\n+\t/** @var \\phpbb\\user */\n+\tprotected $user;\n+\n+\t/** @var string */\n+\tprotected $phpbb_root_path;\n+\n+\t/** @var string */\n+\tprotected $php_ext;\n+\n+\t/** @var array */\n+\tprotected $cfg_array = array();\n+\n+\t/** @var array */\n+\tprotected $new_config = array();\n+\n+\t/** @var string */\n+\tpublic $u_action;\n+\n+\t/**\n+\t * Constructor\n+\t *\n+\t * @param \\phpbb\\config\\config              $config               Config object\n+\t * @param \\phpbb\\db\\driver\\driver_interface $db                   Database object\n+\t * @param \\phpbb\\language\\language          $language             Language object\n+\t * @param \\phpbb\\log\\log                    $log                  Log object\n+\t * @param \\phpbb\\request\\request            $request              Request object\n+\t * @param \\phpbb\\template\\template          $template             Template object\n+\t * @param \\phpbb\\user                       $user                 User object\n+\t * @param string                            $root_path            phpBB root path\n+\t * @param string                            $php_ext              php_ext\n+\t * @access public\n+\t */\n+\tpublic function __construct(\\phpbb\\config\\config $config, \\phpbb\\db\\driver\\driver_interface $db, \\phpbb\\language\\language $language, \\phpbb\\log\\log $log, \\phpbb\\request\\request $request, \\phpbb\\template\\template $template, \\phpbb\\user $user, $root_path, $php_ext)\n+\t{\n+\t\t$this->config = $config;\n+\t\t$this->db = $db;\n+\t\t$this->language = $language;\n+\t\t$this->log = $log;\n+\t\t$this->request = $request;\n+\t\t$this->template = $template;\n+\t\t$this->user = $user;\n+\t\t$this->phpbb_root_path = $root_path;\n+\t\t$this->php_ext = $php_ext;\n+\t}\n+\n+\t/**\n+\t * Display the options a user can configure for this extension\n+\t *\n+\t * @return null\n+\t * @access public\n+\t */\n+\tpublic function display_options()\n+\t{\n+\t\t$this->template->assign_vars(array(\n+\t\t\t'IDEAS_POSTER'\t\t=> $this->get_ideas_topics_poster_username(),\n+\t\t\t'IDEAS_BASE_URL'\t=> ($this->config['ideas_base_url']) ?: '',\n+\n+\t\t\t'S_FORUM_SELECT_BOX'\t=> $this->select_ideas_forum(),\n+\t\t\t'S_IDEAS_FORUM_ID'\t\t=> !empty($this->config['ideas_forum_id']),\n+\n+\t\t\t'U_ACTION'\t\t\t=> $this->u_action,\n+\t\t\t'U_FIND_USERNAME'\t=> append_sid(\"{$this->phpbb_root_path}memberlist.{$this->php_ext}\", 'mode=searchuser&amp;form=acp_phpbb_ideas_settings&amp;field=ideas_poster_id&amp;select_single=true'),\n+\t\t));\n+\t}\n+\n+\t/**\n+\t * Get Ideas poster bot user ID\n+\t *\n+\t * @return int user_id Ideas bot user ID\n+\t * @access protected\n+\t */\n+\tprotected function get_ideas_topics_poster_id()\n+\t{\n+\t\t$sql = 'SELECT user_id\n+\t\t\tFROM ' . USERS_TABLE . \"\n+\t\t\tWHERE username_clean = '\" . $this->db->sql_escape(utf8_clean_string($this->cfg_array['ideas_poster_id'])) . \"'\";\n+\t\t$result = $this->db->sql_query($sql);\n+\t\t$user_id = (int) $this->db->sql_fetchfield('user_id');\n+\t\t$this->db->sql_freeresult($result);\n+\n+\t\treturn $user_id;\n+\t}\n+\n+\t/**\n+\t * Get Ideas poster bot username\n+\t *\n+\t * @return string Ideas bot username\n+\t * @access protected\n+\t */\n+\tprotected function get_ideas_topics_poster_username()\n+\t{\n+\t\t$sql = 'SELECT username FROM ' . USERS_TABLE . '\n+\t\t\tWHERE user_id = ' . (int) $this->config['ideas_poster_id'];\n+\t\t$this->db->sql_query($sql);\n+\t\t$username = $this->db->sql_fetchfield('username');\n+\n+\t\treturn ($username !== false) ? $username : '';\n+\t}\n+\n+\t/**\n+\t * Set configuration options\n+\t *\n+\t * @return null\n+\t * @access public\n+\t */\n+\tpublic function set_config_options()\n+\t{\n+\t\t$errors = array();\n+\n+\t\t// This method is called on submit, so set flag to true initially\n+\t\t$submit = true;\n+\n+\t\t$this->cfg_array = ($this->request->is_set('config')) ? $this->request->variable('config', array('' => ''), true) : $this->config;\n+\n+\t\t// Check the form for validity\n+\t\tif (!check_form_key('acp_phpbb_ideas_settings'))\n+\t\t{\n+\t\t\t$errors[] = $this->language->lang('FORM_INVALID');\n+\t\t}\n+\n+\t\t// Check if selected user exists\n+\t\t$user_id = $this->get_ideas_topics_poster_id();\n+\t\tif (!$user_id)\n+\t\t{\n+\t\t\t$errors[] = $this->language->lang('NO_USER');\n+\t\t}\n+\n+\t\t// Don't save settings if errors have occured\n+\t\tif (sizeof($errors))\n+\t\t{\n+\t\t\t$submit = false;\n+\t\t\t$this->cfg_array = $this->config;","path":"controller/admin_controller.php","position":167,"original_position":167,"commit_id":"14b99c9d4f1386aa041500fe89f32c2219200d43","original_commit_id":"14b99c9d4f1386aa041500fe89f32c2219200d43","user":{"login":"VSEphpbb","id":303711,"avatar_url":"https://avatars.githubusercontent.com/u/303711?v=3","gravatar_id":"","url":"https://api.github.com/users/VSEphpbb","html_url":"https://github.com/VSEphpbb","followers_url":"https://api.github.com/users/VSEphpbb/followers","following_url":"https://api.github.com/users/VSEphpbb/following{/other_user}","gists_url":"https://api.github.com/users/VSEphpbb/gists{/gist_id}","starred_url":"https://api.github.com/users/VSEphpbb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VSEphpbb/subscriptions","organizations_url":"https://api.github.com/users/VSEphpbb/orgs","repos_url":"https://api.github.com/users/VSEphpbb/repos","events_url":"https://api.github.com/users/VSEphpbb/events{/privacy}","received_events_url":"https://api.github.com/users/VSEphpbb/received_events","type":"User","site_admin":false},"body":"I do not see this line having any more purpose anymore.","created_at":"2015-12-21T17:13:02Z","updated_at":"2015-12-21T17:13:02Z","html_url":"https://github.com/phpbb/phpbb-ideas/pull/39#discussion_r48167243","pull_request_url":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/comments/48167243"},"html":{"href":"https://github.com/phpbb/phpbb-ideas/pull/39#discussion_r48167243"},"pull_request":{"href":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/39","id":50544142,"html_url":"https://github.com/phpbb/phpbb-ideas/pull/39","diff_url":"https://github.com/phpbb/phpbb-ideas/pull/39.diff","patch_url":"https://github.com/phpbb/phpbb-ideas/pull/39.patch","issue_url":"https://api.github.com/repos/phpbb/phpbb-ideas/issues/39","number":39,"state":"open","locked":false,"title":"Add confirm box to the forum settings button + ajaxify.","user":{"login":"rxu","id":212322,"avatar_url":"https://avatars.githubusercontent.com/u/212322?v=3","gravatar_id":"","url":"https://api.github.com/users/rxu","html_url":"https://github.com/rxu","followers_url":"https://api.github.com/users/rxu/followers","following_url":"https://api.github.com/users/rxu/following{/other_user}","gists_url":"https://api.github.com/users/rxu/gists{/gist_id}","starred_url":"https://api.github.com/users/rxu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxu/subscriptions","organizations_url":"https://api.github.com/users/rxu/orgs","repos_url":"https://api.github.com/users/rxu/repos","events_url":"https://api.github.com/users/rxu/events{/privacy}","received_events_url":"https://api.github.com/users/rxu/received_events","type":"User","site_admin":false},"body":"TODO:\r\n- [x] Refactor ACP module to controller\r\n- [x] Split ACP controller into action specific methods\r\n- [x] Cleanup ACP module and controller","created_at":"2015-11-12T17:52:15Z","updated_at":"2015-12-21T17:13:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e4607041153bf338cc02d7224f837346e29dc41","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/39/commits","review_comments_url":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/39/comments","review_comment_url":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/phpbb/phpbb-ideas/issues/39/comments","statuses_url":"https://api.github.com/repos/phpbb/phpbb-ideas/statuses/14b99c9d4f1386aa041500fe89f32c2219200d43","head":{"label":"rxu:add-ajax-request","ref":"add-ajax-request","sha":"14b99c9d4f1386aa041500fe89f32c2219200d43","user":{"login":"rxu","id":212322,"avatar_url":"https://avatars.githubusercontent.com/u/212322?v=3","gravatar_id":"","url":"https://api.github.com/users/rxu","html_url":"https://github.com/rxu","followers_url":"https://api.github.com/users/rxu/followers","following_url":"https://api.github.com/users/rxu/following{/other_user}","gists_url":"https://api.github.com/users/rxu/gists{/gist_id}","starred_url":"https://api.github.com/users/rxu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxu/subscriptions","organizations_url":"https://api.github.com/users/rxu/orgs","repos_url":"https://api.github.com/users/rxu/repos","events_url":"https://api.github.com/users/rxu/events{/privacy}","received_events_url":"https://api.github.com/users/rxu/received_events","type":"User","site_admin":false},"repo":{"id":44487576,"name":"phpbb-ideas","full_name":"rxu/phpbb-ideas","owner":{"login":"rxu","id":212322,"avatar_url":"https://avatars.githubusercontent.com/u/212322?v=3","gravatar_id":"","url":"https://api.github.com/users/rxu","html_url":"https://github.com/rxu","followers_url":"https://api.github.com/users/rxu/followers","following_url":"https://api.github.com/users/rxu/following{/other_user}","gists_url":"https://api.github.com/users/rxu/gists{/gist_id}","starred_url":"https://api.github.com/users/rxu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxu/subscriptions","organizations_url":"https://api.github.com/users/rxu/orgs","repos_url":"https://api.github.com/users/rxu/repos","events_url":"https://api.github.com/users/rxu/events{/privacy}","received_events_url":"https://api.github.com/users/rxu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rxu/phpbb-ideas","description":"An idea center for phpBB/phpBB.com (based on WordPress idea center).","fork":true,"url":"https://api.github.com/repos/rxu/phpbb-ideas","forks_url":"https://api.github.com/repos/rxu/phpbb-ideas/forks","keys_url":"https://api.github.com/repos/rxu/phpbb-ideas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rxu/phpbb-ideas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rxu/phpbb-ideas/teams","hooks_url":"https://api.github.com/repos/rxu/phpbb-ideas/hooks","issue_events_url":"https://api.github.com/repos/rxu/phpbb-ideas/issues/events{/number}","events_url":"https://api.github.com/repos/rxu/phpbb-ideas/events","assignees_url":"https://api.github.com/repos/rxu/phpbb-ideas/assignees{/user}","branches_url":"https://api.github.com/repos/rxu/phpbb-ideas/branches{/branch}","tags_url":"https://api.github.com/repos/rxu/phpbb-ideas/tags","blobs_url":"https://api.github.com/repos/rxu/phpbb-ideas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rxu/phpbb-ideas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rxu/phpbb-ideas/git/refs{/sha}","trees_url":"https://api.github.com/repos/rxu/phpbb-ideas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rxu/phpbb-ideas/statuses/{sha}","languages_url":"https://api.github.com/repos/rxu/phpbb-ideas/languages","stargazers_url":"https://api.github.com/repos/rxu/phpbb-ideas/stargazers","contributors_url":"https://api.github.com/repos/rxu/phpbb-ideas/contributors","subscribers_url":"https://api.github.com/repos/rxu/phpbb-ideas/subscribers","subscription_url":"https://api.github.com/repos/rxu/phpbb-ideas/subscription","commits_url":"https://api.github.com/repos/rxu/phpbb-ideas/commits{/sha}","git_commits_url":"https://api.github.com/repos/rxu/phpbb-ideas/git/commits{/sha}","comments_url":"https://api.github.com/repos/rxu/phpbb-ideas/comments{/number}","issue_comment_url":"https://api.github.com/repos/rxu/phpbb-ideas/issues/comments{/number}","contents_url":"https://api.github.com/repos/rxu/phpbb-ideas/contents/{+path}","compare_url":"https://api.github.com/repos/rxu/phpbb-ideas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rxu/phpbb-ideas/merges","archive_url":"https://api.github.com/repos/rxu/phpbb-ideas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rxu/phpbb-ideas/downloads","issues_url":"https://api.github.com/repos/rxu/phpbb-ideas/issues{/number}","pulls_url":"https://api.github.com/repos/rxu/phpbb-ideas/pulls{/number}","milestones_url":"https://api.github.com/repos/rxu/phpbb-ideas/milestones{/number}","notifications_url":"https://api.github.com/repos/rxu/phpbb-ideas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rxu/phpbb-ideas/labels{/name}","releases_url":"https://api.github.com/repos/rxu/phpbb-ideas/releases{/id}","created_at":"2015-10-18T17:06:25Z","updated_at":"2015-10-18T17:06:26Z","pushed_at":"2015-12-21T14:54:24Z","git_url":"git://github.com/rxu/phpbb-ideas.git","ssh_url":"git@github.com:rxu/phpbb-ideas.git","clone_url":"https://github.com/rxu/phpbb-ideas.git","svn_url":"https://github.com/rxu/phpbb-ideas","homepage":null,"size":670,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"31x"}},"base":{"label":"phpbb:master","ref":"master","sha":"1ab646640d2efa0ca48c2f77369e192068d1ded2","user":{"login":"phpbb","id":176697,"avatar_url":"https://avatars.githubusercontent.com/u/176697?v=3","gravatar_id":"","url":"https://api.github.com/users/phpbb","html_url":"https://github.com/phpbb","followers_url":"https://api.github.com/users/phpbb/followers","following_url":"https://api.github.com/users/phpbb/following{/other_user}","gists_url":"https://api.github.com/users/phpbb/gists{/gist_id}","starred_url":"https://api.github.com/users/phpbb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpbb/subscriptions","organizations_url":"https://api.github.com/users/phpbb/orgs","repos_url":"https://api.github.com/users/phpbb/repos","events_url":"https://api.github.com/users/phpbb/events{/privacy}","received_events_url":"https://api.github.com/users/phpbb/received_events","type":"Organization","site_admin":false},"repo":{"id":11393427,"name":"phpbb-ideas","full_name":"phpbb/phpbb-ideas","owner":{"login":"phpbb","id":176697,"avatar_url":"https://avatars.githubusercontent.com/u/176697?v=3","gravatar_id":"","url":"https://api.github.com/users/phpbb","html_url":"https://github.com/phpbb","followers_url":"https://api.github.com/users/phpbb/followers","following_url":"https://api.github.com/users/phpbb/following{/other_user}","gists_url":"https://api.github.com/users/phpbb/gists{/gist_id}","starred_url":"https://api.github.com/users/phpbb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpbb/subscriptions","organizations_url":"https://api.github.com/users/phpbb/orgs","repos_url":"https://api.github.com/users/phpbb/repos","events_url":"https://api.github.com/users/phpbb/events{/privacy}","received_events_url":"https://api.github.com/users/phpbb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phpbb/phpbb-ideas","description":"An idea center for phpBB/phpBB.com (based on WordPress idea center).","fork":false,"url":"https://api.github.com/repos/phpbb/phpbb-ideas","forks_url":"https://api.github.com/repos/phpbb/phpbb-ideas/forks","keys_url":"https://api.github.com/repos/phpbb/phpbb-ideas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phpbb/phpbb-ideas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phpbb/phpbb-ideas/teams","hooks_url":"https://api.github.com/repos/phpbb/phpbb-ideas/hooks","issue_events_url":"https://api.github.com/repos/phpbb/phpbb-ideas/issues/events{/number}","events_url":"https://api.github.com/repos/phpbb/phpbb-ideas/events","assignees_url":"https://api.github.com/repos/phpbb/phpbb-ideas/assignees{/user}","branches_url":"https://api.github.com/repos/phpbb/phpbb-ideas/branches{/branch}","tags_url":"https://api.github.com/repos/phpbb/phpbb-ideas/tags","blobs_url":"https://api.github.com/repos/phpbb/phpbb-ideas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phpbb/phpbb-ideas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phpbb/phpbb-ideas/git/refs{/sha}","trees_url":"https://api.github.com/repos/phpbb/phpbb-ideas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phpbb/phpbb-ideas/statuses/{sha}","languages_url":"https://api.github.com/repos/phpbb/phpbb-ideas/languages","stargazers_url":"https://api.github.com/repos/phpbb/phpbb-ideas/stargazers","contributors_url":"https://api.github.com/repos/phpbb/phpbb-ideas/contributors","subscribers_url":"https://api.github.com/repos/phpbb/phpbb-ideas/subscribers","subscription_url":"https://api.github.com/repos/phpbb/phpbb-ideas/subscription","commits_url":"https://api.github.com/repos/phpbb/phpbb-ideas/commits{/sha}","git_commits_url":"https://api.github.com/repos/phpbb/phpbb-ideas/git/commits{/sha}","comments_url":"https://api.github.com/repos/phpbb/phpbb-ideas/comments{/number}","issue_comment_url":"https://api.github.com/repos/phpbb/phpbb-ideas/issues/comments{/number}","contents_url":"https://api.github.com/repos/phpbb/phpbb-ideas/contents/{+path}","compare_url":"https://api.github.com/repos/phpbb/phpbb-ideas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phpbb/phpbb-ideas/merges","archive_url":"https://api.github.com/repos/phpbb/phpbb-ideas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phpbb/phpbb-ideas/downloads","issues_url":"https://api.github.com/repos/phpbb/phpbb-ideas/issues{/number}","pulls_url":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls{/number}","milestones_url":"https://api.github.com/repos/phpbb/phpbb-ideas/milestones{/number}","notifications_url":"https://api.github.com/repos/phpbb/phpbb-ideas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phpbb/phpbb-ideas/labels{/name}","releases_url":"https://api.github.com/repos/phpbb/phpbb-ideas/releases{/id}","created_at":"2013-07-13T19:59:47Z","updated_at":"2015-10-20T01:33:45Z","pushed_at":"2015-12-21T14:54:24Z","git_url":"git://github.com/phpbb/phpbb-ideas.git","ssh_url":"git@github.com:phpbb/phpbb-ideas.git","clone_url":"https://github.com/phpbb/phpbb-ideas.git","svn_url":"https://github.com/phpbb/phpbb-ideas","homepage":null,"size":699,"stargazers_count":10,"watchers_count":10,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":1,"forks":8,"open_issues":1,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/39"},"html":{"href":"https://github.com/phpbb/phpbb-ideas/pull/39"},"issue":{"href":"https://api.github.com/repos/phpbb/phpbb-ideas/issues/39"},"comments":{"href":"https://api.github.com/repos/phpbb/phpbb-ideas/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/phpbb/phpbb-ideas/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/phpbb/phpbb-ideas/statuses/14b99c9d4f1386aa041500fe89f32c2219200d43"}}}}