{"code": " public function __construct()\n {\n parent::__construct();\n\n $this->middleware(\n static function ($request, $next) {\n app('view')->share('title', (string)trans('firefly.transactions'));\n app('view')->share('mainTitleIcon', 'fa-exchange');\n\n return $next($request);\n }\n );\n }", "label_name": "CWE-352", "label": 0}
{"code": " public function testDuplicateAction()\n {\n $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);\n $this->request($client, '/admin/teams/1/duplicate');\n $this->assertIsRedirect($client, '/edit');\n $client->followRedirect();\n $node = $client->getCrawler()->filter('#team_edit_form_name');\n self::assertEquals(1, $node->count());\n self::assertEquals('Test team [COPY]', $node->attr('value'));\n }", "label_name": "CWE-352", "label": 0}
{"code": "\t\t\t\tesc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $r->new_version ) ),\n\t\t\t\t$r->new_version\n\t\t\t);", "label_name": "CWE-352", "label": 0}
{"code": " function __construct($uid, $folder = null, $is_safe = false)\n {\n // decode combined UID-folder identifier\n if (preg_match('/^\\d+-.+/', $uid)) {\n list($uid, $folder) = explode('-', $uid, 2);\n }\n\n $this->uid = $uid;\n $this->app = rcube::get_instance();\n $this->storage = $this->app->get_storage();\n $this->folder = strlen($folder) ? $folder : $this->storage->get_folder();\n\n // Set current folder\n $this->storage->set_folder($this->folder);\n $this->storage->set_options(array('all_headers' => true));\n\n $this->headers = $this->storage->get_message($uid);\n\n if (!$this->headers) {\n return;\n }\n\n $this->mime = new rcube_mime($this->headers->charset);\n $this->subject = $this->headers->get('subject');\n list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1));\n\n $this->set_safe($is_safe || $_SESSION['safe_messages'][$this->folder.':'.$uid]);\n $this->opt = array(\n 'safe' => $this->is_safe,\n 'prefer_html' => $this->app->config->get('prefer_html'),\n 'get_url' => $this->app->url(array(\n 'action' => 'get',\n 'mbox' => $this->folder,\n 'uid' => $uid))\n );\n\n if (!empty($this->headers->structure)) {\n $this->get_mime_numbers($this->headers->structure);\n $this->parse_structure($this->headers->structure);\n }\n else {\n $this->body = $this->storage->get_body($uid);\n }\n\n // notify plugins and let them analyze this structured message object\n $this->app->plugins->exec_hook('message_load', array('object' => $this));\n }", "label_name": "CWE-352", "label": 0}
{"code": " $q = self::$mysqli->query($vars) ;\n if($q === false) {\n user_error(\"Query failed: \".self::$mysqli->error.\"
\\n$vars\"); \n return false; \n }\n }\n \n return $q;\n }", "label_name": "CWE-352", "label": 0}
{"code": "\tpublic function __construct()\n\t{\n\t\t$this->headers = \\App\\Controller\\Headers::getInstance();\n\t\tif (!self::$activatedLocale && \\App\\Config::performance('CHANGE_LOCALE')) {\n\t\t\t\\App\\Language::initLocale();\n\t\t\tself::$activatedLocale = true;\n\t\t}\n\t\tif (!self::$activatedCsrf) {\n\t\t\tif ($this->csrfActive && \\App\\Config::security('csrfActive')) {\n\t\t\t\trequire_once 'config/csrf_config.php';\n\t\t\t\t\\CsrfMagic\\Csrf::init();\n\t\t\t\t$this->csrfActive = true;\n\t\t\t} else {\n\t\t\t\t$this->csrfActive = false;\n\t\t\t}\n\t\t\tself::$activatedCsrf = true;\n\t\t}\n\t}", "label_name": "CWE-352", "label": 0}
{"code": " public static function insert($vars) {\n if(is_array($vars)) {\n $slug = Typo::slugify($vars['title']);\n $vars = array_merge($vars, array('slug' => $slug));\n //print_r($vars);\n $ins = array(\n 'table' => 'options',\n 'key' => $vars\n );\n $post = Db::insert($ins);\n }\n return $post;\n }", "label_name": "CWE-352", "label": 0}
{"code": " public function enableCurrency(TransactionCurrency $currency)\n {\n app('preferences')->mark();\n\n $this->repository->enable($currency);\n session()->flash('success', (string)trans('firefly.currency_is_now_enabled', ['name' => $currency->name]));\n Log::channel('audit')->info(sprintf('Enabled currency %s.', $currency->code));\n\n return redirect(route('currencies.index'));\n }", "label_name": "CWE-352", "label": 0}
{"code": " public function delete(){\n $item_id = I(\"item_id/d\"); \n $login_user = $this->checkLogin();\n $uid = $login_user['uid'] ;\n if(!$this->checkItemManage($uid , $item_id)){\n $this->sendError(10303);\n return ;\n } \n $item_member_id = I(\"item_member_id/d\");\n\n if ($item_member_id) {\n $member_array = D(\"ItemMember\")->where(\" item_id = '%d' and item_member_id = '%d' \",array($item_id,$item_member_id))->find();\n $ret = D(\"ItemMember\")->where(\" item_id = '%d' and item_member_id = '%d' \",array($item_id,$item_member_id))->delete();\n\n }\n if ($ret) {\n $this->sendResult($ret);\n }else{\n $this->sendError(10101);\n }\n }", "label_name": "CWE-352", "label": 0}
{"code": " public function delete(){\n $item_id = I(\"item_id/d\"); \n $id = I(\"id/d\"); \n $login_user = $this->checkLogin();\n $uid = $login_user['uid'] ;\n if(!$this->checkItemEdit($uid , $item_id)){\n $this->sendError(10303);\n return ;\n } \n $ret = D(\"ItemVariable\")->where(\" item_id = '%d' and id = '%d' \",array($item_id,$id))->delete();\n if ($ret) {\n $this->sendResult($ret);\n }else{\n $this->sendError(10101);\n }\n }", "label_name": "CWE-352", "label": 0}
{"code": " public function index(Request $request)\n {\n /** @var User $user */\n $user = auth()->user();\n $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');\n $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;\n $collection = $this->repository->getAll();\n $total = $collection->count();\n $collection = $collection->slice(($page - 1) * $pageSize, $pageSize);\n $currencies = new LengthAwarePaginator($collection, $total, $pageSize, $page);\n $currencies->setPath(route('currencies.index'));\n\n $defaultCurrency = $this->repository->getCurrencyByPreference(app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR')));\n $isOwner = true;\n if (!$this->userRepository->hasRole($user, 'owner')) {\n $request->session()->flash('info', (string) trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));\n $isOwner = false;\n }\n\n return prefixView('currencies.index', compact('currencies', 'defaultCurrency', 'isOwner'));\n }", "label_name": "CWE-352", "label": 0}
{"code": "\tpublic function validateWriteAccess($skipRequestTypeCheck = false)\n\t{\n\t\tif (!$skipRequestTypeCheck && 'POST' !== $_SERVER['REQUEST_METHOD']) {\n\t\t\tthrow new \\App\\Exceptions\\Csrf('Invalid request - validate Write Access');\n\t\t}\n\t\t$this->validateReadAccess();\n\t\tif (class_exists('CSRFConfig') && !\\CsrfMagic\\Csrf::check(false)) {\n\t\t\tthrow new \\App\\Exceptions\\Csrf('Unsupported request');\n\t\t}\n\t}", "label_name": "CWE-352", "label": 0}
{"code": " $form .= \"\";\n }\n $form .= \"\";\n addPageFormTool($GLOBALS['strMoveTo'], 'iconTrackerMove', $form);\n\n //delete\n $deleteConfirm = phpAds_DelConfirm($GLOBALS['strConfirmDeleteTracker']);\n addPageLinkTool($GLOBALS[\"strDelete\"], MAX::constructUrl(MAX_URL_ADMIN, \"tracker-delete.php?token=\" . urlencode(phpAds_SessionGetToken()) . \"&clientid=\".$advertiserId.\"&trackerid=\".$trackerId.\"&returnurl=advertiser-trackers.php\"), \"iconDelete\", null, $deleteConfirm);\n addPageShortcut($GLOBALS['strBackToTrackers'], MAX::constructUrl(MAX_URL_ADMIN, \"advertiser-trackers.php?clientid=$advertiserId\"), \"iconBack\");\n }", "label_name": "CWE-352", "label": 0}
{"code": " public function uninstall($templatename)\n {\n if (Permission::model()->hasGlobalPermission('templates', 'update')) {\n if (!Template::hasInheritance($templatename)) {\n TemplateConfiguration::uninstall($templatename);\n } else {\n Yii::app()->setFlashMessage(sprintf(gT(\"You can't uninstall template '%s' because some templates inherit from it.\"), $templatename), 'error');\n }\n } else {\n Yii::app()->setFlashMessage(gT(\"We are sorry but you don't have permissions to do this.\"), 'error');\n }\n\n $this->getController()->redirect(array(\"admin/themeoptions\"));\n }", "label_name": "CWE-352", "label": 0}
{"code": " public function destroy(Request $request, TransactionCurrency $currency)\n {\n /** @var User $user */\n $user = auth()->user();\n if (!$this->userRepository->hasRole($user, 'owner')) {\n\n $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));\n Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code));\n\n return redirect(route('currencies.index'));\n\n }\n\n if ($this->repository->currencyInUse($currency)) {\n $request->session()->flash('error', (string) trans('firefly.cannot_delete_currency', ['name' => e($currency->name)]));\n Log::channel('audit')->info(sprintf('Tried to delete currency %s but is in use.', $currency->code));\n\n return redirect(route('currencies.index'));\n }\n\n if ($this->repository->isFallbackCurrency($currency)) {\n $request->session()->flash('error', (string) trans('firefly.cannot_delete_fallback_currency', ['name' => e($currency->name)]));\n Log::channel('audit')->info(sprintf('Tried to delete currency %s but is FALLBACK.', $currency->code));\n\n return redirect(route('currencies.index'));\n }\n\n Log::channel('audit')->info(sprintf('Deleted currency %s.', $currency->code));\n $this->repository->destroy($currency);\n\n $request->session()->flash('success', (string) trans('firefly.deleted_currency', ['name' => $currency->name]));\n\n return redirect($this->getPreviousUri('currencies.delete.uri'));\n }", "label_name": "CWE-352", "label": 0}
{"code": "\tfunction check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {\n\t\tif ( -1 == $action ) {\n\t\t\t_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' );\n\t\t}\n\n\t\t$adminurl = strtolower( admin_url() );\n\t\t$referer = strtolower( wp_get_referer() );\n\t\t$result = isset( $_REQUEST[ $query_arg ] ) ? wp_verify_nonce( $_REQUEST[ $query_arg ], $action ) : false;\n\n\t\t/**\n\t\t * Fires once the admin request has been validated or not.\n\t\t *\n\t\t * @since 1.5.1\n\t\t *\n\t\t * @param string $action The nonce action.\n\t\t * @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between\n\t\t * 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.\n\t\t */\n\t\tdo_action( 'check_admin_referer', $action, $result );\n\n\t\tif ( ! $result && ! ( -1 == $action && strpos( $referer, $adminurl ) === 0 ) ) {\n\t\t\twp_nonce_ays( $action );\n\t\t\tdie();\n\t\t}\n\n\t\treturn $result;\n\t}", "label_name": "CWE-352", "label": 0}
{"code": " function __construct()\n {\n # code...\n self::$smtphost = Options::get('smtphost');\n self::$smtpuser = Options::get('smtpuser');\n self::$smtppass = Options::get('smtppass');\n self::$smtpssl = Options::get('smtpssl');\n self::$siteemail = Options::get('siteemail');\n self::$sitename = Options::get('sitename');\n }", "label_name": "CWE-352", "label": 0}
{"code": "\tpublic function show_screen_options() {\n\t\tglobal $wp_meta_boxes;\n\n\t\tif ( is_bool( $this->_show_screen_options ) )\n\t\t\treturn $this->_show_screen_options;\n\n\t\t$columns = get_column_headers( $this );\n\n\t\t$show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' );\n\n\t\tswitch ( $this->base ) {\n\t\t\tcase 'widgets':\n\t\t\t\t$this->_screen_settings = '
' . __('Enable accessibility mode') . '' . __('Disable accessibility mode') . \"
\\n\";\n\t\t\t\tbreak;\n\t\t\tcase 'post' :\n\t\t\t\t$expand = '';\n\t\t\t\t$this->_screen_settings = $expand;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->_screen_settings = '';\n\t\t\t\tbreak;\n\t\t}\n\n\t\t/**\n\t\t * Filters the screen settings text displayed in the Screen Options tab.\n\t\t *\n\t\t * This filter is currently only used on the Widgets screen to enable\n\t\t * accessibility mode.\n\t\t *\n\t\t * @since 3.0.0\n\t\t *\n\t\t * @param string $screen_settings Screen settings.\n\t\t * @param WP_Screen $this WP_Screen object.\n\t\t */\n\t\t$this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this );\n\n\t\tif ( $this->_screen_settings || $this->_options )\n\t\t\t$show_screen = true;\n\n\t\t/**\n\t\t * Filters whether to show the Screen Options tab.\n\t\t *\n\t\t * @since 3.2.0\n\t\t *\n\t\t * @param bool $show_screen Whether to show Screen Options tab.\n\t\t * Default true.\n\t\t * @param WP_Screen $this Current WP_Screen instance.\n\t\t */\n\t\t$this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this );\n\t\treturn $this->_show_screen_options;\n\t}", "label_name": "CWE-352", "label": 0} {"code": " function logon($username, $password, &$sessionId)\n {\n global $_POST, $_COOKIE;\n global $strUsernameOrPasswordWrong;\n\n /**\n * @todo Please check if the following statement is in correct place because\n * it seems illogical that user can get session ID from internal login with\n * a bad username or password.\n */\n\n if (!$this->_verifyUsernameAndPasswordLength($username, $password)) {\n return false;\n }\n\n $_POST['username'] = $username;\n $_POST['password'] = $password;\n\n $_POST['login'] = 'Login';\n\n $_COOKIE['sessionID'] = uniqid('phpads', 1);\n $_POST['phpAds_cookiecheck'] = $_COOKIE['sessionID'];\n\n $this->preInitSession();\n if ($this->_internalLogin($username, $password)) {\n // Check if the user has administrator access to Openads.\n if (OA_Permission::isUserLinkedToAdmin()) {\n\n $this->postInitSession();\n\n $sessionId = $_COOKIE['sessionID'];\n return true;\n } else {\n\n $this->raiseError('User must be OA installation admin');\n return false;\n }\n } else {\n\n $this->raiseError($strUsernameOrPasswordWrong);\n return false;\n }\n }", "label_name": "CWE-384", "label": 1} {"code": "\t\t\t\t$text .= varset($val['helpText']) ? \"