diff --git "a/validation.jsonl" "b/validation.jsonl" --- "a/validation.jsonl" +++ "b/validation.jsonl" @@ -1,542 +1,573 @@ -{"code": " static function encrypt($string, $key) {\n\n $result = '';\n for ($i=0; $iisSearchable()) {\n//\t\t\t $mods[$controller->name()] = $controller->addContentToSearch();\n $mods[$controller->searchName()] = $controller->addContentToSearch();\n\t\t }\n\t }\n\t\n\t uksort($mods,'strnatcasecmp');\n\t assign_to_template(array(\n 'mods'=>$mods\n ));\n }", "label_name": "CWE-74", "label": "74"} -{"code": " private function generateTempFileData()\n {\n return [\n 'name' => md5(mt_rand()),\n 'tmp_name' => tempnam(sys_get_temp_dir(), ''),\n 'type' => 'image/jpeg',\n 'size' => mt_rand(1000, 10000),\n 'error' => '0',\n ];\n }", "label_name": "CWE-330", "label": "330"} -{"code": "\tstatic public function getHighestOrderNumber($_uid = 0) {\n\n\t\t$where = '';\n\t\t$sel_data = array();\n\t\tif ($_uid > 0) {\n\t\t\t$where = \" WHERE `adminid` = :adminid\";\n\t\t\t$sel_data['adminid'] = $_uid;\n\t\t}\n\t\t$sql = \"SELECT MAX(`logicalorder`) as `highestorder` FROM `\" . TABLE_PANEL_TICKET_CATS . \"`\".$where.\";\";\n\t\t$result_stmt = Database::prepare($sql);\n\t\t$result = Database::pexecute_first($result_stmt, $sel_data);\n\t\treturn (isset($result['highestorder']) ? (int)$result['highestorder'] : 0);\n\t}", "label_name": "CWE-732", "label": "732"} -{"code": " public function downloadfile() {\n if (empty($this->params['fileid'])) {\n flash('error', gt('There was an error while trying to download your file. No File Specified.'));\n expHistory::back();\n }\n \n $fd = new filedownload($this->params['fileid']); \n if (empty($this->params['filenum'])) $this->params['filenum'] = 0;\n\n if (empty($fd->expFile['downloadable'][$this->params['filenum']]->id)) {\n flash('error', gt('There was an error while trying to download your file. The file you were looking for could not be found.'));\n expHistory::back();\n } \n \n $fd->downloads++;\n $fd->save();\n \n // this will set the id to the id of the actual file..makes the download go right.\n $this->params['id'] = $fd->expFile['downloadable'][$this->params['filenum']]->id;\n parent::downloadfile(); \n }", "label_name": "CWE-74", "label": "74"} -{"code": "function article_save()\n{\n global $txp_user, $vars, $prefs;\n\n extract($prefs);\n\n $incoming = array_map('assert_string', psa($vars));\n\n $oldArticle = safe_row('Status, url_title, Title, '.\n 'unix_timestamp(LastMod) as sLastMod, LastModID, '.\n 'unix_timestamp(Posted) as sPosted, '.\n 'unix_timestamp(Expires) as sExpires',\n 'textpattern', 'ID = '.(int) $incoming['ID']);", "label_name": "CWE-269", "label": "269"} -{"code": " public function manage()\n {\n expHistory::set('manageable',$this->params);\n $gc = new geoCountry();\n $countries = $gc->find('all');\n \n $gr = new geoRegion(); \n $regions = $gr->find('all',null,'rank asc,name asc');\n \n assign_to_template(array(\n 'countries'=>$countries,\n 'regions'=>$regions\n ));\n }", "label_name": "CWE-74", "label": "74"} -{"code": " recyclebin::sendToRecycleBin($loc, $parent);\r\n //FIXME if we delete the module & sectionref the module completely disappears\r\n// if (class_exists($secref->module)) {\r\n// $modclass = $secref->module;\r\n// //FIXME: more module/controller glue code\r\n// if (expModules::controllerExists($modclass)) {\r\n// $modclass = expModules::getControllerClassName($modclass);\r\n// $mod = new $modclass($loc->src);\r\n// $mod->delete_instance();\r\n// } else {\r\n// $mod = new $modclass();\r\n// $mod->deleteIn($loc);\r\n// }\r\n// }\r\n }\r\n// $db->delete('sectionref', 'section=' . $parent);\r\n $db->delete('section', 'parent=' . $parent);\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": "function get_filedisplay_views() {\n expTemplate::get_filedisplay_views();\n\n $paths = array(\n BASE.'framework/modules/common/views/file/',\n BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/',\n );\n \n $views = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {\n $filename = substr($file, 0, -4);\n $views[$filename] = gt($filename);\n }\n }\n }\n }\n \n return $views;\n}", "label_name": "CWE-74", "label": "74"} -{"code": "\tpublic static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) {\n\t\t$config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'globalnewfiles' );\n\n\t\tif ( $config->get( 'CreateWikiDatabase' ) === $config->get( 'DBname' ) ) {\n\t\t\t$updater->addExtensionTable(\n\t\t\t\t'gnf_files',\n\t\t\t\t__DIR__ . '/../sql/gnf_files.sql'\n\t\t\t);\n\n\t\t\t$updater->modifyExtensionField(\n\t\t\t\t'gnf_files',\n\t\t\t\t'files_timestamp',\n\t\t\t\t__DIR__ . '/../sql/patches/patch-gnf_files-binary.sql' \n\t\t\t);\n\n\t\t\t$updater->modifyTable(\n \t\t\t\t'gnf_files',\n \t\t\t\t__DIR__ . '/../sql/patches/patch-gnf_files-add-indexes.sql',\n\t\t\t\ttrue\n \t\t\t);\n\t\t}\n\n\t\treturn true;\n\t}", "label_name": "CWE-20", "label": "20"} -{"code": "function get_filedisplay_views() {\n expTemplate::get_filedisplay_views();\n\n $paths = array(\n BASE.'framework/modules/common/views/file/',\n BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/',\n );\n \n $views = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {\n $filename = substr($file, 0, -4);\n $views[$filename] = gt($filename);\n }\n }\n }\n }\n \n return $views;\n}", "label_name": "CWE-74", "label": "74"} -{"code": " function fopen($filename, $mode)\n {\n if (\\yiiunit\\framework\\base\\SecurityTest::$fopen !== null) {\n return \\yiiunit\\framework\\base\\SecurityTest::$fopen;\n }\n\n return \\fopen($filename, $mode);\n }", "label_name": "CWE-330", "label": "330"} -{"code": " foreach ($day as $extevent) {\r\n $event_cache = new stdClass();\r\n $event_cache->feed = $extgcalurl;\r\n $event_cache->event_id = $extevent->event_id;\r\n $event_cache->title = $extevent->title;\r\n $event_cache->body = $extevent->body;\r\n $event_cache->eventdate = $extevent->eventdate->date;\r\n if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400)\r\n $event_cache->dateFinished = $extevent->dateFinished;\r\n if (isset($extevent->eventstart))\r\n $event_cache->eventstart = $extevent->eventstart;\r\n if (isset($extevent->eventend))\r\n $event_cache->eventend = $extevent->eventend;\r\n if (isset($extevent->is_allday))\r\n $event_cache->is_allday = $extevent->is_allday;\r\n $found = false;\r\n if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries\r\n $found = $db->selectObject('event_cache','feed=\"'.$extgcalurl.'\" AND event_id=\"'.$event_cache->event_id.'\" AND eventdate='.$event_cache->eventdate);\r\n if (!$found)\r\n $db->insertObject($event_cache,'event_cache');\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": " public function showall_tags() {\n $images = $this->image->find('all');\n $used_tags = array();\n foreach ($images as $image) {\n foreach($image->expTag as $tag) {\n if (isset($used_tags[$tag->id])) {\n $used_tags[$tag->id]->count++;\n } else {\n $exptag = new expTag($tag->id);\n $used_tags[$tag->id] = $exptag;\n $used_tags[$tag->id]->count = 1;\n }\n \n }\n }\n \n assign_to_template(array(\n 'tags'=>$used_tags\n ));\n } ", "label_name": "CWE-74", "label": "74"} -{"code": "function XMLRPCremoveImageGroupFromComputerGroup($imageGroup, $computerGroup){\n $imageid = getResourceGroupID(\"image/$imageGroup\");\n $compid = getResourceGroupID(\"computer/$computerGroup\");\n if($imageid && $compid){\n $tmp = getUserResources(array(\"imageAdmin\"),\n array(\"manageMapping\"), 1);\n $imagegroups = $tmp['image'];\n $tmp = getUserResources(array(\"computerAdmin\"),\n array(\"manageMapping\"), 1);\n $computergroups = $tmp['computer'];\n\n if(array_key_exists($compid, $computergroups) &&\n array_key_exists($imageid, $imagegroups)){\n $mapping = getResourceMapping(\"image\", \"computer\",\n $imageid,\n $compid);\n if(array_key_exists($imageid, $mapping) &&\n array_key_exists($compid, $mapping[$imageid])){\n $query = \"DELETE FROM resourcemap \"\n\t\t\t\t\t . \"WHERE resourcegroupid1 = $imageid AND \"\n\t\t\t\t\t . \"resourcetypeid1 = 13 AND \"\n\t\t\t\t\t . \"resourcegroupid2 = $compid AND \"\n\t\t\t\t\t . \"resourcetypeid2 = 12\";\n\t\t\t doQuery($query, 101);\n }\n return array('status' => 'success');\n } else {\n return array('status' => 'error',\n 'errorcode' => 84,\n 'errormsg' => 'cannot access computer and/or image group');\n }\n } else {\n return array('status' => 'error',\n 'errorcode' => 83,\n 'errormsg' => 'invalid resource group name');\n }\n}", "label_name": "CWE-20", "label": "20"} -{"code": " public static function DragnDropReRank2() {\r\n global $router, $db;\r\n\r\n $id = $router->params['id'];\r\n $page = new section($id);\r\n $old_rank = $page->rank;\r\n $old_parent = $page->parent;\r\n $new_rank = $router->params['position'] + 1; // rank\r\n $new_parent = intval($router->params['parent']);\r\n\r\n $db->decrement($page->tablename, 'rank', 1, 'rank>' . $old_rank . ' AND parent=' . $old_parent); // close in hole\r\n $db->increment($page->tablename, 'rank', 1, 'rank>=' . $new_rank . ' AND parent=' . $new_parent); // make room\r\n\r\n $params = array();\r\n $params['parent'] = $new_parent;\r\n $params['rank'] = $new_rank;\r\n $page->update($params);\r\n\r\n self::checkForSectionalAdmins($id);\r\n expSession::clearAllUsersSessionCache('navigation');\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": " public function testLogoutDelete()\n {\n $GLOBALS['cfg']['Server']['auth_swekey_config'] = '';\n $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = '';\n $GLOBALS['cfg']['CaptchaLoginPublicKey'] = '';\n $_REQUEST['old_usr'] = 'pmaolduser';\n $GLOBALS['cfg']['LoginCookieDeleteAll'] = true;\n $GLOBALS['cfg']['Servers'] = array(1);\n\n $_COOKIE['pmaPass-0'] = 'test';\n\n $this->object->authCheck();\n\n $this->assertFalse(\n isset($_COOKIE['pmaPass-0'])\n );\n }", "label_name": "CWE-200", "label": "200"} -{"code": " public function getCompiledPath($path)\n {\n return $this->cachePath.'/'.sha1($path).'.php';\n }", "label_name": "CWE-327", "label": "327"} -{"code": " public function manage_sitemap() {\r\n global $db, $user, $sectionObj, $sections;\r\n\r\n expHistory::set('viewable', $this->params);\r\n $id = $sectionObj->id;\r\n $current = null;\r\n // all we need to do is determine the current section\r\n $navsections = $sections;\r\n if ($sectionObj->parent == -1) {\r\n $current = $sectionObj;\r\n } else {\r\n foreach ($navsections as $section) {\r\n if ($section->id == $id) {\r\n $current = $section;\r\n break;\r\n }\r\n }\r\n }\r\n assign_to_template(array(\r\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\r\n 'sections' => $navsections,\r\n 'current' => $current,\r\n 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),\r\n ));\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": "function XMLRPCgetUserGroups($groupType=0, $affiliationid=0) {\n global $user;\n $groups = getUserGroups($groupType, $affiliationid);\n\n // Filter out any groups to which the user does not have access.\n $usergroups = array();\n foreach($groups as $id => $group){\n if($group['ownerid'] == $user['id'] || \n (array_key_exists(\"editgroupid\", $group) &&\n array_key_exists($group['editgroupid'], $user[\"groups\"])) || \n (array_key_exists($id, $user[\"groups\"]))){\n array_push($usergroups, $group);\n }\n }\n return array(\n \"status\" => \"success\",\n \"groups\" => $usergroups);\n}", "label_name": "CWE-20", "label": "20"} -{"code": "\tstatic public function deleteCategory($_id = 0) {\n\n\t\tif ($_id != 0) {\n\n\t\t\t$result_stmt = Database::prepare(\"\n\t\t\t\tSELECT COUNT(`id`) as `numtickets` FROM `\" . TABLE_PANEL_TICKETS . \"`\n\t\t\t\tWHERE `category` = :cat\"\n\t\t\t);\n\t\t\t$result = Database::pexecute_first($result_stmt, array('cat' => $_id));\n\n\t\t\tif ($result['numtickets'] == \"0\") {\n\t\t\t\t$del_stmt = Database::prepare(\"\n\t\t\t\t\tDELETE FROM `\" . TABLE_PANEL_TICKET_CATS . \"` WHERE `id` = :id\"\n\t\t\t\t);\n\t\t\t\tDatabase::pexecute($del_stmt, array('id' => $_id));\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "label_name": "CWE-732", "label": "732"} -{"code": " public function testRemoveAuthorizationHeaderOnRedirect()\n {\n $mock = new MockHandler([\n new Response(302, ['Location' => 'http://test.com']),\n static function (RequestInterface $request) {\n self::assertFalse($request->hasHeader('Authorization'));\n return new Response(200);\n }\n ]);\n $handler = HandlerStack::create($mock);\n $client = new Client(['handler' => $handler]);\n $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass']]);\n }", "label_name": "CWE-863", "label": "863"} -{"code": "\tprivate function _addauthor( $option ) {\n\t\t//Addauthor can not be used with addlasteditor.\n\t\tif ( !isset( $this->parametersProcessed['addlasteditor'] ) || !$this->parametersProcessed['addlasteditor'] ) {\n\t\t\t$this->addTable( 'revision_actor_temp', 'rev' );\n\t\t\t$this->addWhere(\n\t\t\t\t[\n\t\t\t\t\t$this->tableNames['page'] . '.page_id = rev.revactor_page',\n\t\t\t\t\t'rev.revactor_timestamp = (SELECT MIN(rev_aux_min.revactor_timestamp) FROM ' . $this->tableNames['revision_actor_temp'] . ' AS rev_aux_min WHERE rev_aux_min.revactor_page = rev.revactor_page)'\n\t\t\t\t]\n\t\t\t);\n\t\t\t$this->_adduser( null, 'rev' );\n\t\t}\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " public static function getItems($term) {\n $model = X2Model::model(Yii::app()->controller->modelClass);\n if (isset($model)) {\n $tableName = $model->tableName();\n $sql = 'SELECT id, name as value \n FROM ' . $tableName . ' WHERE name LIKE :qterm ORDER BY name ASC';\n $command = Yii::app()->db->createCommand($sql);\n $qterm = $term . '%';\n $command->bindParam(\":qterm\", $qterm, PDO::PARAM_STR);\n $result = $command->queryAll();\n echo CJSON::encode($result);\n }\n Yii::app()->end();\n }", "label_name": "CWE-20", "label": "20"} -{"code": " private function userCanSeeUserGroups($project_id)\n {\n $project = $this->project_manager->getProject($project_id);\n $user = $this->user_manager->getCurrentUser();\n ProjectAuthorization::userCanAccessProject($user, $project, new URLVerification());\n\n return true;\n }", "label_name": "CWE-863", "label": "863"} -{"code": "\tpublic function getPurchaseOrderByJSON() {\n\n\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}\n\n\t\techo json_encode($purchase_orders);\n\t}", "label_name": "CWE-20", "label": "20"} -{"code": " public function getTrustedProxyData()\n {\n return array(\n array(array(), array('127.0.0.1')),\n array(array('10.0.0.2'), array('10.0.0.2', '127.0.0.1')),\n array(array('10.0.0.2', '127.0.0.1'), array('10.0.0.2', '127.0.0.1')),\n );\n }", "label_name": "CWE-20", "label": "20"} -{"code": " public function show()\n {\n $task = $this->getTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask_converter/show', array(\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label_name": "CWE-200", "label": "200"} -{"code": " public function remove()\n {\n $this->checkCSRFParam();\n $project = $this->getProject();\n $category = $this->getCategory();\n\n if ($this->categoryModel->remove($category['id'])) {\n $this->flash->success(t('Category removed successfully.'));\n } else {\n $this->flash->failure(t('Unable to remove this category.'));\n }\n\n $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));\n }", "label_name": "CWE-200", "label": "200"} -{"code": " function edit_optiongroup_master() {\n expHistory::set('editable', $this->params);\n \n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $record = new optiongroup_master($id); \n assign_to_template(array(\n 'record'=>$record\n ));\n }", "label_name": "CWE-74", "label": "74"} -{"code": "\tpublic function replace_save_pre_shortcode( $shortcode_match ) {\r\n\t\t$content = $shortcode_match[0];\r\n\t\t$tag_index = array_search( 'geo_mashup_save_location', $shortcode_match ); \r\n\t\tif ( $tag_index !== false ) {\r\n\t\t\t// There is an inline location - save the attributes\r\n\t\t\t$this->inline_location = shortcode_parse_atts( stripslashes( $shortcode_match[$tag_index+1] ) );\r\n\r\n\t\t\t// If lat and lng are missing, try to geocode based on address\r\n\t\t\t$success = false;\r\n\t\t\tif ( ( empty( $this->inline_location['lat'] ) or empty( $this->inline_location['lng'] ) ) and !empty( $this->inline_location['address'] ) ) {\r\n\t\t\t\t$query = $this->inline_location['address'];\r\n\t\t\t\t$this->inline_location = GeoMashupDB::blank_object_location( ARRAY_A );\r\n\t\t\t\t$success = GeoMashupDB::geocode( $query, $this->inline_location );\r\n\t\t\t\tif ( !$success ) {\r\n\t\t\t\t\t// Delay and try again\r\n\t\t\t\t\tsleep( 1 );\r\n\t\t\t\t\t$success = GeoMashupDB::geocode( $query, $this->inline_location );\r\n\t\t\t\t}\r\n\t\t\t} else if ( is_numeric ( $this->inline_location['lat'] ) and is_numeric( $this->inline_location['lng'] ) ) {\r\n\t\t\t\t// lat and lng were supplied\r\n\t\t\t\t$success = true;\r\n\t\t\t}\r\n\r\n\t\t\tif ( $success ) {\r\n\t\t\t\t// Remove the tag\r\n\t\t\t\t$content = '';\r\n\t\t\t} else {\r\n\t\t\t\t$message = ( is_wp_error( GeoMashupDB::$geocode_error ) ? GeoMashupDB::$geocode_error->get_error_message() : __( 'Address not found - try making it less detailed', 'GeoMashup' ) );\r\n\t\t\t\t$content = str_replace( ']', ' geocoding_error=\"' . $message . '\"]', $content );\r\n\t\t\t\t$this->inline_location = null;\r\n\t\t\t}\r\n\t\t} \r\n\t\treturn $content;\r\n\t}\r", "label_name": "CWE-20", "label": "20"} -{"code": " public function testLogout()\n {\n $GLOBALS['cfg']['Server']['auth_swekey_config'] = '';\n $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = '';\n $GLOBALS['cfg']['CaptchaLoginPublicKey'] = '';\n $_REQUEST['old_usr'] = 'pmaolduser';\n $GLOBALS['cfg']['LoginCookieDeleteAll'] = false;\n $GLOBALS['cfg']['Servers'] = array(1);\n $GLOBALS['server'] = 1;\n\n $_COOKIE['pmaPass-1'] = 'test';\n\n $this->object->authCheck();\n\n $this->assertFalse(\n isset($_COOKIE['pmaPass-1'])\n );\n }", "label_name": "CWE-200", "label": "200"} -{"code": " public function gc($force = false, $expiredOnly = true)\n {\n if ($force || mt_rand(0, 1000000) < $this->gcProbability) {\n $this->gcRecursive($this->cachePath, $expiredOnly);\n }\n }", "label_name": "CWE-330", "label": "330"} -{"code": " function delete_recurring() {\r\n $item = $this->event->find('first', 'id=' . $this->params['id']);\r\n if ($item->is_recurring == 1) { // need to give user options\r\n expHistory::set('editable', $this->params);\r\n assign_to_template(array(\r\n 'checked_date' => $this->params['date_id'],\r\n 'event' => $item,\r\n ));\r\n } else { // Process a regular delete\r\n $item->delete();\r\n }\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": " self::removeLevel($kid->id);\r\n }\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": "\t\t\t$parameter = strtolower( $parameter ); //Force lower case for ease of use.\n\t\t\tif ( empty( $parameter ) || substr( $parameter, 0, 1 ) == '#' || ( $this->parameters->exists( $parameter ) && !$this->parameters->testRichness( $parameter ) ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif ( !$this->parameters->exists( $parameter ) ) {\n\t\t\t\t$this->logger->addMessage( \\DynamicPageListHooks::WARN_UNKNOWNPARAM, $parameter, implode( ', ', $this->parameters->getParametersForRichness() ) );\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t//Ignore parameter settings without argument (except namespace and category).\n\t\t\tif ( !strlen( $option ) ) {\n\t\t\t\tif ( $parameter != 'namespace' && $parameter != 'notnamespace' && $parameter != 'category' && $this->parameters->exists( $parameter ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$parameters[$parameter][] = $option;\n\t\t}\n\t\treturn $parameters;\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) {\n\n if ($is_revisioned) {\n $object->revision_id++;\n //if ($table==\"text\") eDebug($object);\n $res = $this->insertObject($object, $table);\n //if ($table==\"text\") eDebug($object,true); \n $this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT);\n return $res;\n }\n $sql = \"UPDATE \" . $this->prefix . \"$table SET \";\n foreach (get_object_vars($object) as $var => $val) {\n //We do not want to save any fields that start with an '_'\n //if($is_revisioned && $var=='revision_id') $val++;\n if ($var{0} != '_') {\n if (is_array($val) || is_object($val)) {\n $val = serialize($val); \n $sql .= \"`$var`='\".$val.\"',\";\n } else {\n $sql .= \"`$var`='\" . $this->escapeString($val) . \"',\";\n }\n }\n }\n $sql = substr($sql, 0, -1) . \" WHERE \";\n if ($where != null)\n $sql .= $this->injectProof($where);\n else\n $sql .= \"`\" . $identifier . \"`=\" . $object->$identifier;\n //if ($table == 'text') eDebug($sql,true); \n $res = (@mysqli_query($this->connection, $sql) != false);\n return $res;\n }", "label_name": "CWE-74", "label": "74"} -{"code": " function edit_freeform() {\r\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\r\n if ($section->parent == -1) {\r\n notfoundController::handle_not_found();\r\n exit;\r\n } // doesn't work for standalone pages\r\n if (empty($section->id)) {\r\n $section->public = 1;\r\n if (!isset($section->parent)) {\r\n // This is another precaution. The parent attribute\r\n // should ALWAYS be set by the caller.\r\n //FJD - if that's the case, then we should die.\r\n notfoundController::handle_not_authorized();\r\n exit;\r\n //$section->parent = 0;\r\n }\r\n }\r\n assign_to_template(array(\r\n 'section' => $section,\r\n 'glyphs' => self::get_glyphs(),\r\n ));\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": " public function __construct(OrderService $orderService)\n {\n $this->orderService = $orderService;\n }", "label_name": "CWE-200", "label": "200"} -{"code": " public function save() {\n $data = $_POST['file'];\n\n // security (remove all ..)\n $data['name'] = str_replace('..', '', $data['name']);\n $file = FILES_DIR . DS . $data['name'];\n \n // CSRF checks\n if (isset($_POST['csrf_token'])) {\n $csrf_token = $_POST['csrf_token'];\n if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/save/'.$data['name'])) {\n Flash::set('error', __('Invalid CSRF token found!'));\n redirect(get_url('plugin/file_manager/view/'.$data['name']));\n }\n }\n else {\n Flash::set('error', __('No CSRF token found!'));\n redirect(get_url('plugin/file_manager/view/'.$data['name']));\n }\n \n if (file_exists($file)) {\n if (file_put_contents($file, $data['content']) !== false) {\n Flash::set('success', __('File has been saved with success!'));\n } else {\n Flash::set('error', __('File is not writable! File has not been saved!'));\n }\n } else {\n if (file_put_contents($file, $data['content'])) {\n Flash::set('success', __('File :name has been created with success!', array(':name' => $data['name'])));\n } else {\n Flash::set('error', __('Directory is not writable! File has not been saved!'));\n }\n }\n\n // save and quit or save and continue editing ?\n if (isset($_POST['commit'])) {\n redirect(get_url('plugin/file_manager/browse/' . substr($data['name'], 0, strrpos($data['name'], '/'))));\n } else {\n redirect(get_url('plugin/file_manager/view/' . $data['name'] . (endsWith($data['name'], URL_SUFFIX) ? '?has_url_suffix=1' : '')));\n }", "label_name": "CWE-20", "label": "20"} -{"code": " public function checkHTTP($link, $get_body = false)\n {\n if (! function_exists('curl_init')) {\n return null;\n }\n $handle = curl_init($link);\n if ($handle === false) {\n return null;\n }\n PMA_Util::configureCurl($handle);\n curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 0);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);\n curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);\n curl_setopt($handle, CURLOPT_TIMEOUT, 5);\n curl_setopt($handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);\n if (! defined('TESTSUITE')) {\n session_write_close();\n }\n $data = @curl_exec($handle);\n if (! defined('TESTSUITE')) {\n ini_set('session.use_only_cookies', '0');\n ini_set('session.use_cookies', '0');\n ini_set('session.use_trans_sid', '0');\n ini_set('session.cache_limiter', 'nocache');\n session_start();\n }\n if ($data === false) {\n return null;\n }\n $http_status = curl_getinfo($handle, CURLINFO_HTTP_CODE);\n\n if ($http_status == 200) {\n return $get_body ? $data : true;\n }\n\n if ($http_status == 404) {\n return false;\n }\n return null;\n }", "label_name": "CWE-20", "label": "20"} -{"code": " function delete_selected() {\r\n $item = $this->event->find('first', 'id=' . $this->params['id']);\r\n if ($item && $item->is_recurring == 1) {\r\n $event_remaining = false;\r\n $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id);\r\n foreach ($eventdates as $ed) {\r\n if (array_key_exists($ed->id, $this->params['dates'])) {\r\n $ed->delete();\r\n } else {\r\n $event_remaining = true;\r\n }\r\n }\r\n if (!$event_remaining) {\r\n $item->delete(); // model will also ensure we delete all event dates\r\n }\r\n expHistory::back();\r\n } else {\r\n notfoundController::handle_not_found();\r\n }\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": " protected function renderImageByImagick($code)\n {\n $backColor = $this->transparent ? new \\ImagickPixel('transparent') : new \\ImagickPixel('#' . str_pad(dechex($this->backColor), 6, 0, STR_PAD_LEFT));\n $foreColor = new \\ImagickPixel('#' . str_pad(dechex($this->foreColor), 6, 0, STR_PAD_LEFT));\n\n $image = new \\Imagick();\n $image->newImage($this->width, $this->height, $backColor);\n\n $draw = new \\ImagickDraw();\n $draw->setFont($this->fontFile);\n $draw->setFontSize(30);\n $fontMetrics = $image->queryFontMetrics($draw, $code);\n\n $length = strlen($code);\n $w = (int) $fontMetrics['textWidth'] - 8 + $this->offset * ($length - 1);\n $h = (int) $fontMetrics['textHeight'] - 8;\n $scale = min(($this->width - $this->padding * 2) / $w, ($this->height - $this->padding * 2) / $h);\n $x = 10;\n $y = round($this->height * 27 / 40);\n for ($i = 0; $i < $length; ++$i) {\n $draw = new \\ImagickDraw();\n $draw->setFont($this->fontFile);\n $draw->setFontSize((int) (mt_rand(26, 32) * $scale * 0.8));\n $draw->setFillColor($foreColor);\n $image->annotateImage($draw, $x, $y, mt_rand(-10, 10), $code[$i]);\n $fontMetrics = $image->queryFontMetrics($draw, $code[$i]);\n $x += (int) $fontMetrics['textWidth'] + $this->offset;\n }\n\n $image->setImageFormat('png');\n return $image->getImageBlob();\n }", "label_name": "CWE-330", "label": "330"} -{"code": " public function store(CreateAppointmentCalendarRequest $request)\n {\n \n $client_id = null;\n $user = User::where('external_id', $request->user)->first();\n\n if ($request->client_external_id) {\n $client_id = Client::where('external_id', $request->client_external_id)->first()->id;\n if (!$client_id) {\n return response(__(\"Client not found\"), 422);\n }\n }\n\n $request_type = null;\n $request_id = null;\n if ($request->source_type && $request->source_external_id) {\n $request_type = $request->source_type;\n\n $entry = $request_type::whereExternalId($request->source_external_id);\n $request_id = $entry->id;\n }\n\n if (!$user) {\n return response(__(\"User not found\"), 422);\n }\n\n $startTime = str_replace([\"am\", \"pm\", ' '], \"\", $request->start_time) . ':00';\n $endTime = str_replace([\"am\", \"pm\", ' '], \"\", $request->end_time) . ':00';\n\n \n\n $appointment = Appointment::create([\n 'external_id' => Uuid::uuid4()->toString(),\n 'source_type' => $request_type,\n 'source_id' => $request_id,\n 'client_id' => $client_id,\n 'title' => $request->title,\n 'start_at' => Carbon::parse($request->start_date . \" \" . $startTime),\n 'end_at' => Carbon::parse($request->end_date . \" \" . $endTime),\n 'user_id' => $user->id,\n 'color' => $request->color\n ]);\n $appointment->user_external_id = $user->external_id;\n $appointment->start_at = $appointment->start_at;\n\n return response($appointment);\n }", "label_name": "CWE-862", "label": "862"} -{"code": " private function getResponse ($size = 128) {\n $pop3_response = fgets($this->pop_conn, $size);\n\n return $pop3_response;\n }", "label_name": "CWE-20", "label": "20"} -{"code": " public function manage() {\n expHistory::set('manageable', $this->params);\n \n // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';\n $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f ';\n $sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type=\"banner\")';\n\t\t\n\t\t$page = new expPaginator(array(\n\t\t\t'model'=>'banner',\n\t\t\t'sql'=>$sql,\n\t\t\t'order'=>'title',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n\t\t\t'columns'=>array(\n gt('Title')=>'title',\n gt('Company')=>'companyname',\n gt('Impressions')=>'impressions',\n gt('Clicks')=>'clicks'\n )\n ));\n\n\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", "label_name": "CWE-74", "label": "74"} -{"code": "\tprivate function setHeader( $header ) {\n\t\tif ( \\DynamicPageListHooks::getDebugLevel() == 5 ) {\n\t\t\t$header = '
' . $header;\n\t\t}\n\t\t$this->header = $this->replaceVariables( $header );\n\t}", "label_name": "CWE-400", "label": "400"}
-{"code": "function XMLRPCgetResourceGroupPrivs($name, $type, $nodeid){\n    require_once(\".ht-inc/privileges.php\");\n    global $user;\n\n    if(! checkUserHasPriv(\"resourceGrant\", $user['id'], $nodeid)){\n        return array('status' => 'error',\n                     'errorcode' => 53,\n                     'errormsg' => 'Unable to add resource group to this node');\n    }\n\n    if($typeid = getResourceTypeID($type)){\n        if(!checkForGroupName($name, 'resource', '', $typeid)){\n            return array('status' => 'error',\n                         'errorcode' => 28,\n                         'errormsg' => 'resource group does not exist');\n        }\n        $nodePrivileges = getNodePrivileges($nodeid, 'resources');\n        $nodePrivileges = getNodeCascadePrivileges($nodeid, 'resources', $nodePrivileges); \n        foreach($nodePrivileges['resources'] as $resource => $privs){\n            if(strstr($resource, \"$type/$name\")){\n                return array(\n                    'status' => 'success',\n                    'privileges' => $privs);\n            }\n        }\n        return array(\n            'status' => 'error',\n            'errorcode' => 29,\n            'errormsg' => 'could not find resource name in privilege list');\n    } else {\n        return array('status' => 'error',\n                     'errorcode' => 56,\n                     'errormsg' => 'Invalid resource type');\n    }\n}", "label_name": "CWE-20", "label": "20"}
-{"code": "    protected function tearDown()\n    {\n        Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, $this->originalTrustedHeaderName);\n    }", "label_name": "CWE-20", "label": "20"}
-{"code": "    public function delete() {\n        global $db, $history;\n        \n        /* The global constants can be overriden by passing appropriate params */ \n        //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n        $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n        $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n        $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n        $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n        \n        if (empty($this->params['id'])) {\n            flash('error', gt('Missing id for the comment you would like to delete'));\n            $lastUrl = expHistory::getLast('editable');\n        }\n        \n        // delete the note\n        $simplenote = new expSimpleNote($this->params['id']);\n        $rows = $simplenote->delete();\n        \n        // delete the assocication too\n        $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']);        \n        \n        // send the user back where they came from.\n        $lastUrl = expHistory::getLast('editable');\n        if (!empty($this->params['tab']))\n        {\n            $lastUrl .= \"#\".$this->params['tab'];\n        }\n        redirect_to($lastUrl);\n    }", "label_name": "CWE-74", "label": "74"}
-{"code": "function httpsTestController($serverPort) {\n  $args = array('HTTPS' => '');\n  var_dump(request(php_uname('n'), $serverPort, \"test_https.php\",\n                  [], [], $args));\n}", "label_name": "CWE-668", "label": "668"}
-{"code": "    public function actionHideWidget() {\n        if (isset($_POST['name'])) {\n            $name = $_POST['name'];\n\n            $layout = Yii::app()->params->profile->getLayout();\n\n            // the widget could be in any of the blocks in the page, so check all of them\n            foreach ($layout as $b => &$block) {\n                if (isset($block[$name])) {\n                    if ($b == 'right') {\n                        $layout['hiddenRight'][$name] = $block[$name];\n                    } else {\n                        $layout['hidden'][$name] = $block[$name];\n                    }\n                    unset($block[$name]);\n                    Yii::app()->params->profile->saveLayout($layout);\n                    break;\n                }\n            }\n\n            // make a list of hidden widgets, using 
  • , to send back to the browser\n $list = \"\";\n foreach ($layout['hidden'] as $name => $widget) {\n $list .= \"
  • {$widget['title']}
  • \";\n }\n foreach ($layout['hiddenRight'] as $name => $widget) {\n $list .= \"
  • {$widget['title']}
  • \";\n }\n\n echo Yii::app()->params->profile->getWidgetMenu();\n }\n }", "label_name": "CWE-20", "label": "20"} -{"code": "\t\t\treturn \"__NOTOC____NOEDITSECTION__\" . \\CategoryViewer::shortList( $articleLinks, $articleStartChars );\n\t\t}\n\t\treturn '';\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": "\t\t\t\t} elseif ( $sSecLabel[0] == '{' ) {\n\t\t\t\t\t// Uses LST::includeTemplate() from LabeledSectionTransclusion extension to include templates from the page\n\t\t\t\t\t// primary syntax {template}suffix\n\t\t\t\t\t$template1 = trim( substr( $sSecLabel, 1, strpos( $sSecLabel, '}' ) - 1 ) );\n\t\t\t\t\t$template2 = trim( str_replace( '}', '', substr( $sSecLabel, 1 ) ) );\n\t\t\t\t\t// alternate syntax: {template|surrogate}\n\t\t\t\t\tif ( $template2 == $template1 && strpos( $template1, '|' ) > 0 ) {\n\t\t\t\t\t\t$template1 = preg_replace( '/\\|.*/', '', $template1 );\n\t\t\t\t\t\t$template2 = preg_replace( '/^.+\\|/', '', $template2 );\n\t\t\t\t\t}\n\t\t\t\t\t//Why the hell was defaultTemplateSuffix be passed all over the place for just fucking here? --Alexia\n\t\t\t\t\t$secPieces = LST::includeTemplate( $this->parser, $this, $s, $article, $template1, $template2, $template2 . $this->getTemplateSuffix(), $mustMatch, $mustNotMatch, $this->includePageParsed, implode( ', ', $article->mCategoryLinks ) );\n\t\t\t\t\t$secPiece[$s] = implode( isset( $this->multiSectionSeparators[$s] ) ? $this->replaceTagCount( $this->multiSectionSeparators[$s], $filteredCount ) : '', $secPieces );\n\t\t\t\t\tif ( $this->getDominantSectionCount() >= 0 && $s == $this->getDominantSectionCount() && count( $secPieces ) > 1 ) {\n\t\t\t\t\t\t$dominantPieces = $secPieces;\n\t\t\t\t\t}\n\t\t\t\t\tif ( ( $mustMatch != '' || $mustNotMatch != '' ) && count( $secPieces ) <= 1 && $secPieces[0] == '' ) {\n\t\t\t\t\t\t$matchFailed = true; // NOTHING MATCHED\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {", "label_name": "CWE-400", "label": "400"} -{"code": " public function actionGetItems(){\n $sql = 'SELECT id, name as value FROM x2_products WHERE name LIKE :qterm ORDER BY name ASC';\n $command = Yii::app()->db->createCommand($sql);\n $qterm = $_GET['term'].'%';\n $command->bindParam(\":qterm\", $qterm, PDO::PARAM_STR);\n $result = $command->queryAll();\n echo CJSON::encode($result); exit;\n }", "label_name": "CWE-20", "label": "20"} -{"code": " public function showall() {\n expHistory::set('viewable', $this->params);\n $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;\n if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {\n $limit = '0';\n }\n $order = isset($this->config['order']) ? $this->config['order'] : \"rank\";\n $page = new expPaginator(array(\n 'model'=>'photo',\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>$limit,\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']),\n 'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));\n \n assign_to_template(array(\n 'page'=>$page,\n 'params'=>$this->params,\n ));\n }", "label_name": "CWE-74", "label": "74"} -{"code": "\tpublic function addSelect( $fields ) {\n\t\tif ( !is_array( $fields ) ) {\n\t\t\tthrow new \\MWException( __METHOD__ . ': A non-array was passed.' );\n\t\t}\n\t\tforeach ( $fields as $alias => $field ) {\n\t\t\tif ( !is_numeric( $alias ) && array_key_exists( $alias, $this->select ) && $this->select[$alias] != $field ) {\n\t\t\t\t//In case of a code bug that is overwriting an existing field alias throw an exception.\n\t\t\t\tthrow new \\MWException( __METHOD__ . \": Attempted to overwrite existing field alias `{$this->select[$alias]}` AS `{$alias}` with `{$field}` AS `{$alias}`.\" );\n\t\t\t}\n\t\t\t//String alias and does not exist already.\n\t\t\tif ( !is_numeric( $alias ) && !array_key_exists( $alias, $this->select ) ) {\n\t\t\t\t$this->select[$alias] = $field;\n\t\t\t}\n\n\t\t\t//Speed up by not using in_array() or array_key_exists(). Toss the field names into their own array as keys => true to exploit a speedy look up with isset().\n\t\t\tif ( is_numeric( $alias ) && !isset( $this->selectedFields[$field] ) ) {\n\t\t\t\t$this->select[] = $field;\n\t\t\t\t$this->selectedFields[$field] = true;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " protected function renderText ($field, $makeLinks, $textOnly, $encode) {\n $fieldName = $field->fieldName;\n $value = preg_replace(\"/(\\
    )|\\n/\",\" \",$this->owner->$fieldName);\n return Yii::app()->controller->convertUrls($this->render ($value, $encode));\n }", "label_name": "CWE-20", "label": "20"} -{"code": " function addDiscountToCart() {\n// global $user, $order;\n global $order;\n //lookup discount to see if it's real and valid, and not already in our cart\n //this will change once we allow more than one coupon code\n\n $discount = new discounts();\n $discount = $discount->getCouponByName($this->params['coupon_code']);\n\n if (empty($discount)) {\n flash('error', gt(\"This discount code you entered does not exist.\"));\n //redirect_to(array('controller'=>'cart', 'action'=>'checkout')); \n expHistory::back();\n }\n\n //check to see if it's in our cart already\n if ($this->isDiscountInCart($discount->id)) {\n flash('error', gt(\"This discount code is already in your cart.\"));\n //redirect_to(array('controller'=>'cart', 'action'=>'checkout'));\n expHistory::back();\n }\n\n //this should really be reworked, as it shoudn't redirect directly and not return\n $validateDiscountMessage = $discount->validateDiscount();\n if ($validateDiscountMessage == \"\") {\n //if all good, add to cart, otherwise it will have redirected\n $od = new order_discounts();\n $od->orders_id = $order->id;\n $od->discounts_id = $discount->id;\n $od->coupon_code = $discount->coupon_code;\n $od->title = $discount->title;\n $od->body = $discount->body;\n $od->save();\n // set this to just the discount applied via this coupon?? if so, when though? $od->discount_total = ??;\n flash('message', gt(\"The discount code has been applied to your cart.\"));\n } else {\n flash('error', $validateDiscountMessage);\n }\n //redirect_to(array('controller'=>'cart', 'action'=>'checkout')); \n expHistory::back();\n }", "label_name": "CWE-20", "label": "20"} -{"code": " public function testESIHeaderIsKeptInSubrequest()\n {\n $expectedSubRequest = Request::create('/');\n $expectedSubRequest->headers->set('Surrogate-Capability', 'abc=\"ESI/1.0\"');\n\n if (Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)) {\n $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));\n $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');\n }\n\n $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));\n\n $request = Request::create('/');\n $request->headers->set('Surrogate-Capability', 'abc=\"ESI/1.0\"');\n $strategy->render('/', $request);\n }", "label_name": "CWE-20", "label": "20"} -{"code": "\tpublic static function setArray( $arg ) {\n\t\t$numargs = count( $arg );\n\t\tif ( $numargs < 5 ) {\n\t\t\treturn '';\n\t\t}\n\t\t$var = trim( $arg[2] );\n\t\t$value = $arg[3];\n\t\t$delimiter = $arg[4];\n\t\tif ( $var == '' ) {\n\t\t\treturn '';\n\t\t}\n\t\tif ( $value == '' ) {\n\t\t\tself::$memoryArray[$var] = [];\n\t\t\treturn;\n\t\t}\n\t\tif ( $delimiter == '' ) {\n\t\t\tself::$memoryArray[$var] = [\n\t\t\t\t$value\n\t\t\t];\n\t\t\treturn;\n\t\t}\n\t\tif ( 0 !== strpos( $delimiter, '/' ) || ( strlen( $delimiter ) - 1 ) !== strrpos( $delimiter, '/' ) ) {\n\t\t\t$delimiter = '/\\s*' . $delimiter . '\\s*/';\n\t\t}\n\t\tself::$memoryArray[$var] = preg_split( $delimiter, $value );\n\t\treturn \"value={$value}, delimiter={$delimiter},\" . count( self::$memoryArray[$var] );\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " public function confirm()\n {\n $project = $this->getProject();\n\n $this->response->html($this->helper->layout->project('action/remove', array(\n 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')),\n 'available_events' => $this->eventManager->getAll(),\n 'available_actions' => $this->actionManager->getAvailableActions(),\n 'project' => $project,\n 'title' => t('Remove an action')\n )));\n }", "label_name": "CWE-200", "label": "200"} -{"code": "\tpublic function setListAttributes( $attributes ) {\n\t\t$this->listAttributes = \\Sanitizer::fixTagAttributes( $attributes, 'ul' );\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " protected function tearDown()\n {\n static::$functions = [];\n static::$fopen = null;\n static::$fread = null;\n parent::tearDown();\n }", "label_name": "CWE-330", "label": "330"} -{"code": " foreach($image->expTag as $tag) {\n if (isset($used_tags[$tag->id])) {\n $used_tags[$tag->id]->count++;\n } else {\n $exptag = new expTag($tag->id);\n $used_tags[$tag->id] = $exptag;\n $used_tags[$tag->id]->count = 1;\n }\n \n }", "label_name": "CWE-74", "label": "74"} -{"code": " private function getTaskLink()\n {\n $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id'));\n\n if (empty($link)) {\n throw new PageNotFoundException();\n }\n\n return $link;\n }", "label_name": "CWE-200", "label": "200"} -{"code": " public function confirm()\n {\n $task = $this->getTask();\n $link = $this->getTaskLink();\n\n $this->response->html($this->template->render('task_internal_link/remove', array(\n 'link' => $link,\n 'task' => $task,\n )));\n }", "label_name": "CWE-200", "label": "200"} -{"code": " function update_option_master() { \n global $db;\n\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $opt = new option_master($id);\n $oldtitle = $opt->title;\n \n $opt->update($this->params);\n \n // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $opt->title) {\n \n }$db->sql('UPDATE '.$db->prefix.'option SET title=\"'.$opt->title.'\" WHERE option_master_id='.$opt->id);\n \n expHistory::back();\n }", "label_name": "CWE-74", "label": "74"} -{"code": " public function actionGetItems($modelType){\n \n $sql = 'SELECT id, name as value FROM x2_campaigns WHERE name LIKE :qterm ORDER BY name ASC';\n \n $command = Yii::app()->db->createCommand($sql);\n $qterm = '%'.$_GET['term'].'%';\n $command->bindParam(\":qterm\", $qterm, PDO::PARAM_STR);\n $result = $command->queryAll();\n echo CJSON::encode($result);\n exit;\n }", "label_name": "CWE-20", "label": "20"} -{"code": "\tprivate function _lastmodifiedby( $option ) {\n\t $user = new \\User;\n\n\t $this->addWhere( $this->DB->addQuotes( $user->newFromName( $option )->getActorId() ) . ' = (SELECT revactor_actor FROM ' . $this->tableNames['revision_actor_temp'] . ' WHERE ' . $this->tableNames['revision_actor_temp'] . '.revactor_page=page_id ORDER BY ' . $this->tableNames['revision_actor_temp'] . '.revactor_timestamp DESC LIMIT 1)' );\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " public function confirm()\n {\n $task = $this->getTask();\n $link_id = $this->request->getIntegerParam('link_id');\n $link = $this->taskExternalLinkModel->getById($link_id);\n\n if (empty($link)) {\n throw new PageNotFoundException();\n }\n\n $this->response->html($this->template->render('task_external_link/remove', array(\n 'link' => $link,\n 'task' => $task,\n )));\n }", "label_name": "CWE-200", "label": "200"} -{"code": " $section = new section(intval($page));\r\n if ($section) {\r\n// self::deleteLevel($section->id);\r\n $section->delete();\r\n }\r\n }\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": " foreach ($events as $event) {\r\n $extevents[$date][] = $event;\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": "\t\t\t$iloc = expUnserialize($container->internal);\n\t\t\tif ($db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"'\") == null) {\n\t\t\t// There is no sectionref for this container. Populate sectionref\n if ($container->external != \"N;\") {\n $newSecRef = new stdClass();\n $newSecRef->module = $iloc->mod;\n $newSecRef->source = $iloc->src;\n $newSecRef->internal = '';\n $newSecRef->refcount = 1;\n// $newSecRef->is_original = 1;\n\t\t\t\t\t$eloc = expUnserialize($container->external);\n//\t\t\t\t\t$section = $db->selectObject('sectionref',\"module='containermodule' AND source='\".$eloc->src.\"'\");\n $section = $db->selectObject('sectionref',\"module='container' AND source='\".$eloc->src.\"'\");\n\t\t\t\t\tif (!empty($section)) {\n\t\t\t\t\t\t$newSecRef->section = $section->id;\n\t\t\t\t\t\t$db->insertObject($newSecRef,\"sectionref\");\n\t\t\t\t\t\t$missing_sectionrefs[] = gt(\"Missing sectionref for container replaced\").\": \".$iloc->mod.\" - \".$iloc->src.\" - PageID #\".$section->id;\n\t\t\t\t\t} else {\n $db->delete('container','id=\"'.$container->id.'\"');\n $missing_sectionrefs[] = gt(\"Cant' find the container page for container\").\": \".$iloc->mod.\" - \".$iloc->src.' - '.gt('deleted');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'missing_sectionrefs'=>$missing_sectionrefs,\n ));\n\t}", "label_name": "CWE-74", "label": "74"} -{"code": "\tprivate function convertTimestamp( $inputDate ) {\n\t\t$timestamp = $inputDate;\n\t\tswitch ( $inputDate ) {\n\t\t\tcase 'today':\n\t\t\t\t$timestamp = date( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last hour':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1H' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last day':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1D' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last week':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P7D' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last month':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1M' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last year':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1Y' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( is_numeric( $timestamp ) ) {\n\t\t\treturn $this->DB->addQuotes( $timestamp );\n\t\t}\n\t\treturn 0;\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " $query->whereExists(function ($permissionQuery) use (&$tableDetails, $action) {\n /** @var Builder $permissionQuery */\n $permissionQuery->select(['role_id'])->from('joint_permissions')\n ->whereColumn('joint_permissions.entity_id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn'])\n ->whereColumn('joint_permissions.entity_type', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityTypeColumn'])\n ->where('action', '=', $action)\n ->whereIn('role_id', $this->getCurrentUserRoles())\n ->where(function (QueryBuilder $query) {\n $this->addJointHasPermissionCheck($query, $this->currentUser()->id);\n });\n });\n });", "label_name": "CWE-863", "label": "863"} -{"code": "\tprivate function _notlinksto( $option ) {\n\t\tif ( $this->parameters->getParameter( 'distinct' ) == 'strict' ) {\n\t\t\t$this->addGroupBy( 'page_title' );\n\t\t}\n\t\tif ( count( $option ) ) {\n\t\t\t$where = $this->tableNames['page'] . '.page_id NOT IN (SELECT ' . $this->tableNames['pagelinks'] . '.pl_from FROM ' . $this->tableNames['pagelinks'] . ' WHERE ';\n\t\t\t$ors = [];\n\t\t\tforeach ( $option as $linkGroup ) {\n\t\t\t\tforeach ( $linkGroup as $link ) {\n\t\t\t\t\t$_or = '(' . $this->tableNames['pagelinks'] . '.pl_namespace=' . intval( $link->getNamespace() );\n\t\t\t\t\tif ( strpos( $link->getDbKey(), '%' ) >= 0 ) {\n\t\t\t\t\t\t$operator = 'LIKE';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$operator = '=';\n\t\t\t\t\t}\n\t\t\t\t\tif ( $this->parameters->getParameter( 'ignorecase' ) ) {\n\t\t\t\t\t\t$_or .= ' AND LOWER(CAST(' . $this->tableNames['pagelinks'] . '.pl_title AS char)) ' . $operator . ' LOWER(' . $this->DB->addQuotes( $link->getDbKey() ) . '))';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$_or .= ' AND ' . $this->tableNames['pagelinks'] . '.pl_title ' . $operator . ' ' . $this->DB->addQuotes( $link->getDbKey() ) . ')';\n\t\t\t\t\t}\n\t\t\t\t\t$ors[] = $_or;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$where .= '(' . implode( ' OR ', $ors ) . '))';\n\t\t}\n\t\t$this->addWhere( $where );\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " public function getDisplayName ($plural=true) {\n return Yii::t('calendar', 'Calendar');\n }", "label_name": "CWE-20", "label": "20"} -{"code": " public function pending() {\n// global $db;\n \n // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.'));\n\n // find the subscriber and their pending subscriptions\n $ealerts = expeAlerts::getPendingBySubscriber($this->params['id']);\n $subscriber = new subscribers($this->params['id']);\n \n // render the template\n assign_to_template(array(\n 'subscriber'=>$subscriber,\n 'ealerts'=>$ealerts\n ));\n }", "label_name": "CWE-74", "label": "74"} -{"code": " static function description() {\n return gt(\"This module is for managing categories in your store.\");\n }", "label_name": "CWE-74", "label": "74"} -{"code": " recyclebin::sendToRecycleBin($loc, $parent);\r\n //FIXME if we delete the module & sectionref the module completely disappears\r\n// if (class_exists($secref->module)) {\r\n// $modclass = $secref->module;\r\n// //FIXME: more module/controller glue code\r\n// if (expModules::controllerExists($modclass)) {\r\n// $modclass = expModules::getControllerClassName($modclass);\r\n// $mod = new $modclass($loc->src);\r\n// $mod->delete_instance();\r\n// } else {\r\n// $mod = new $modclass();\r\n// $mod->deleteIn($loc);\r\n// }\r\n// }\r\n }\r\n// $db->delete('sectionref', 'section=' . $parent);\r\n $db->delete('section', 'parent=' . $parent);\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": "\tpublic function addJoin( $tableAlias, $joinConditions ) {\n\t\tif ( empty( $tableAlias ) || empty( $joinConditions ) ) {\n\t\t\tthrow new \\MWException( __METHOD__ . ': An empty join clause was passed.' );\n\t\t}\n\t\tif ( isset( $this->join[$tableAlias] ) ) {\n\t\t\tthrow new \\MWException( __METHOD__ . ': Attempted to overwrite existing join clause.' );\n\t\t}\n\t\t$this->join[$tableAlias] = $joinConditions;\n\t\treturn true;\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " foreach ($days as $event) {\r\n if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time()))\r\n break;\r\n if (empty($event->eventstart))\r\n $event->eventstart = $event->eventdate->date;\r\n $extitem[] = $event;\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": "\t\t\t$this->where = array_merge( $this->where, $where );\n\t\t} else {\n\t\t\tthrow new \\MWException( __METHOD__ . ': An invalid where clause was passed.' );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " public function actionGetItems(){\n $model = X2Model::model ($this->modelClass);\n if (isset ($model)) {\n $tableName = $model->tableName ();\n $sql = \n 'SELECT id, subject as value\n FROM '.$tableName.' WHERE subject LIKE :qterm ORDER BY subject ASC';\n $command = Yii::app()->db->createCommand($sql);\n $qterm = $_GET['term'].'%';\n $command->bindParam(\":qterm\", $qterm, PDO::PARAM_STR);\n $result = $command->queryAll();\n echo CJSON::encode($result);\n }\n Yii::app()->end();\n }", "label_name": "CWE-20", "label": "20"} -{"code": "\tpublic function register()\n\t{\n\t\tJSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));\n\n\t\t// Get the application\n\t\t$app = JFactory::getApplication();\n\n\t\t// Get the form data.\n\t\t$data = $this->input->post->get('user', array(), 'array');\n\n\t\t// Get the model and validate the data.\n\t\t$model = $this->getModel('Registration', 'UsersModel');\n\n\t\t$form = $model->getForm();\n\n\t\tif (!$form)\n\t\t{\n\t\t\tJError::raiseError(500, $model->getError());\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$return = $model->validate($form, $data);\n\n\t\t// Check for errors.\n\t\tif ($return === false)\n\t\t{\n\t\t\t// Get the validation messages.\n\t\t\t$errors = $model->getErrors();\n\n\t\t\t// Push up to three validation messages out to the user.\n\t\t\tfor ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)\n\t\t\t{\n\t\t\t\tif ($errors[$i] instanceof Exception)\n\t\t\t\t{\n\t\t\t\t\t$app->enqueueMessage($errors[$i]->getMessage(), 'notice');\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$app->enqueueMessage($errors[$i], 'notice');\n\t\t\t}\n\n\t\t\t// Save the data in the session.\n\t\t\t$app->setUserState('users.registration.form.data', $data);\n\n\t\t\t// Redirect back to the registration form.\n\t\t\t$this->setRedirect('index.php?option=com_users&view=registration');\n\n\t\t\treturn false;\n\t\t}\n\n\t\t// Finish the registration.\n\t\t$return = $model->register($data);\n\n\t\t// Check for errors.\n\t\tif ($return === false)\n\t\t{\n\t\t\t// Save the data in the session.\n\t\t\t$app->setUserState('users.registration.form.data', $data);\n\n\t\t\t// Redirect back to the registration form.\n\t\t\t$message = JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError());\n\t\t\t$this->setRedirect('index.php?option=com_users&view=registration', $message, 'error');\n\n\t\t\treturn false;\n\t\t}\n\n\t\t// Flush the data from the session.\n\t\t$app->setUserState('users.registration.form.data', null);\n\n\t\treturn true;\n\t}", "label_name": "CWE-20", "label": "20"} -{"code": " public function manage() {\n expHistory::set('viewable', $this->params);\n \n $page = new expPaginator(array(\n\t\t\t'model'=>'order_status',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n //'columns'=>array('Name'=>'title')\n ));\n\n\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", "label_name": "CWE-74", "label": "74"} -{"code": " public function testAuth()\n {\n if (! defined('PMA_TEST_HEADERS')) {\n $this->markTestSkipped(\n 'Cannot redefine constant/function - missing runkit extension'\n );\n }\n\n // case 1\n\n $GLOBALS['cfg']['Server']['SignonURL'] = '';\n\n ob_start();\n $this->object->auth();\n $result = ob_get_clean();\n\n $this->assertContains(\n 'You must set SignonURL!',\n $result\n );\n\n // case 2\n\n $GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL';\n $_REQUEST['old_usr'] = 'oldUser';\n $GLOBALS['cfg']['Server']['LogoutURL'] = 'http://phpmyadmin.net/logoutURL';\n\n $this->object->auth();\n\n $this->assertContains(\n 'Location: http://phpmyadmin.net/logoutURL?PHPSESSID=',\n $GLOBALS['header'][0]\n );\n\n // case 3\n\n $GLOBALS['header'] = array();\n $GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL';\n $_REQUEST['old_usr'] = '';\n $GLOBALS['cfg']['Server']['LogoutURL'] = '';\n\n $this->object->auth();\n\n $this->assertContains(\n 'Location: http://phpmyadmin.net/SignonURL?PHPSESSID=',\n $GLOBALS['header'][0]\n );\n }", "label_name": "CWE-200", "label": "200"} -{"code": " function edit_section() {\r\n global $db, $user;\r\n\r\n $parent = new section($this->params['parent']);\r\n if (empty($parent->id)) $parent->id = 0;\r\n assign_to_template(array(\r\n 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0),\r\n 'parent' => $parent,\r\n 'isAdministrator' => $user->isAdmin(),\r\n ));\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": "\tpublic static function sortByPriority( $parameters ) {\n\t\tif ( !is_array( $parameters ) ) {\n\t\t\tthrow new \\MWException( __METHOD__ . ': A non-array was passed.' );\n\t\t}\n\t\t//'category' to get category headings first for ordermethod.\n\t\t//'include'/'includepage' to make sure section labels are ready for 'table'.\n\t\t$priority = [\n\t\t\t'distinct'\t\t\t=> 1,\n\t\t\t'openreferences'\t=> 2,\n\t\t\t'ignorecase'\t\t=> 3,\n\t\t\t'category'\t\t\t=> 4,\n\t\t\t'title'\t\t\t\t=> 5,\n\t\t\t'goal'\t\t\t\t=> 6,\n\t\t\t'ordercollation'\t=> 7,\n\t\t\t'ordermethod'\t\t=> 8,\n\t\t\t'includepage'\t\t=> 9,\n\t\t\t'include'\t\t\t=> 10\n\t\t];\n\n\t\t$_first = [];\n\t\tforeach ( $priority as $parameter => $order ) {\n\t\t\tif ( isset( $parameters[$parameter] ) ) {\n\t\t\t\t$_first[$parameter] = $parameters[$parameter];\n\t\t\t\tunset( $parameters[$parameter] );\n\t\t\t}\n\t\t}\n\n\t\t$parameters = $_first + $parameters;\n\n\t\treturn $parameters;\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": " foreach ($fields as $field) {\n $fieldName = $field->fieldName;\n if ($field->type == 'date' || $field->type == 'dateTime') {\n if (is_numeric($record->$fieldName))\n $record->$fieldName = Formatter::formatLongDateTime($record->$fieldName);\n }elseif ($field->type == 'link') {\n $name = $record->$fieldName;\n if (!empty($field->linkType)) {\n list($name, $id) = Fields::nameAndId($name);\n }\n if (!empty($name))\n $record->$fieldName = $name;\n }elseif ($fieldName == 'visibility') {\n $record->$fieldName = $record->$fieldName == 1 ? 'Public' : 'Private';\n }\n }", "label_name": "CWE-20", "label": "20"} -{"code": "\t\t$stmt->bindValue(\":$field\", $domain, SQLITE3_TEXT);\n\t\tif($bindcomment) {\n\t\t\t$stmt->bindValue(\":comment\", $comment, SQLITE3_TEXT);\n\t\t}\n\n\t\tif($stmt->execute() && $stmt->reset())\n\t\t\t$num++;\n\t\telse\n\t\t{\n\t\t\t$stmt->close();\n\t\t\tif($returnnum)\n\t\t\t\treturn $num;\n\t\t\telse\n\t\t\t{\n\t\t\t\tif($num === 1)\n\t\t\t\t\t$plural = \"\";\n\t\t\t\telse\n\t\t\t\t\t$plural = \"s\";\n\t\t\t\treturn \"Error: \".$db->lastErrorMsg().\", added \".$num.\" domain\".$plural;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Close prepared statement and return number of processed rows\n\t$stmt->close();\n\t$db->exec(\"COMMIT;\");\n\n\tif($returnnum)\n\t\treturn $num;\n\telse\n\t{\n\t\t$finalcount = intval($db->querySingle($countquery));\n\t\t$modified = $finalcount - $initialcount;\n\n\t\t// If we add less domains than the user specified, then they wanted to add duplicates\n\t\tif($modified !== $num)\n\t\t{\n\t\t\t$delta = $num - $modified;\n\t\t\t$extra = \" (skipped \".$delta.\" duplicates)\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$extra = \"\";\n\t\t}\n\n\t\tif($num === 1)\n\t\t\t$plural = \"\";\n\t\telse\n\t\t\t$plural = \"s\";\n\t\treturn \"Success, added \".$modified.\" of \".$num.\" domain\".$plural.$extra;\n\t}\n}", "label_name": "CWE-862", "label": "862"} -{"code": "\tpublic function approve() {\n\t expHistory::set('editable', $this->params);\n \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];\n\t \n\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }\n\t \n\t $comment = new expComment($this->params['id']);\n\t assign_to_template(array(\n 'comment'=>$comment\n ));\n\t}", "label_name": "CWE-74", "label": "74"} -{"code": " protected function renderImageByGD($code)\n {\n $image = imagecreatetruecolor($this->width, $this->height);\n\n $backColor = imagecolorallocate(\n $image,\n (int) ($this->backColor % 0x1000000 / 0x10000),\n (int) ($this->backColor % 0x10000 / 0x100),\n $this->backColor % 0x100\n );\n imagefilledrectangle($image, 0, 0, $this->width - 1, $this->height - 1, $backColor);\n imagecolordeallocate($image, $backColor);\n\n if ($this->transparent) {\n imagecolortransparent($image, $backColor);\n }\n\n $foreColor = imagecolorallocate(\n $image,\n (int) ($this->foreColor % 0x1000000 / 0x10000),\n (int) ($this->foreColor % 0x10000 / 0x100),\n $this->foreColor % 0x100\n );\n\n $length = strlen($code);\n $box = imagettfbbox(30, 0, $this->fontFile, $code);\n $w = $box[4] - $box[0] + $this->offset * ($length - 1);\n $h = $box[1] - $box[5];\n $scale = min(($this->width - $this->padding * 2) / $w, ($this->height - $this->padding * 2) / $h);\n $x = 10;\n $y = round($this->height * 27 / 40);\n for ($i = 0; $i < $length; ++$i) {\n $fontSize = (int) (mt_rand(26, 32) * $scale * 0.8);\n $angle = mt_rand(-10, 10);\n $letter = $code[$i];\n $box = imagettftext($image, $fontSize, $angle, $x, $y, $foreColor, $this->fontFile, $letter);\n $x = $box[2] + $this->offset;\n }\n\n imagecolordeallocate($image, $foreColor);\n\n ob_start();\n imagepng($image);\n imagedestroy($image);\n\n return ob_get_clean();\n }", "label_name": "CWE-330", "label": "330"} -{"code": "\tstatic public function addCategory($_category = null, $_admin = 1, $_order = 1) {\n\n\t\tif ($_category != null\n\t\t\t&& $_category != ''\n\t\t) {\n\t\t\tif ($_order < 1) {\n\t\t\t\t$_order = 1;\n\t\t\t}\n\n\t\t\t$ins_stmt = Database::prepare(\"\n\t\t\t\tINSERT INTO `\" . TABLE_PANEL_TICKET_CATS . \"` SET\n\t\t\t\t\t`name` = :name,\n\t\t\t\t\t`adminid` = :adminid,\n\t\t\t\t\t`logicalorder` = :lo\"\n\t\t\t);\n\t\t\t$ins_data = array(\n\t\t\t\t'name' => $_category,\n\t\t\t\t'adminid' => $_admin,\n\t\t\t\t'lo' => $_order\n\t\t\t);\n\t\t\tDatabase::pexecute($ins_stmt, $ins_data);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "label_name": "CWE-732", "label": "732"} -{"code": " public function upload() {\n \n // upload the file, but don't save the record yet...\n if ($this->params['resize'] != 'false') {\n $maxwidth = $this->params['max_width'];\n } else {\n $maxwidth = null;\n }\n $file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth);\n // since most likely this function will only get hit via flash in YUI Uploader\n // and since Flash can't pass cookies, we lose the knowledge of our $user\n // so we're passing the user's ID in as $_POST data. We then instantiate a new $user,\n // and then assign $user->id to $file->poster so we have an audit trail for the upload\n\n if (is_object($file)) {\n $resized = !empty($file->resized) ? true : false;\n $user = new user($this->params['usrid']);\n $file->poster = $user->id;\n $file->posted = $file->last_accessed = time();\n $file->save();\n if (!empty($this->params['cat'])) {\n $expcat = new expCat($this->params['cat']);\n $params['expCat'][0] = $expcat->id;\n $file->update($params);\n }\n\n // a echo so YUI Uploader is notified of the function's completion\n if ($resized) {\n echo gt('File resized and then saved');\n } else {\n echo gt('File saved');\n }\n } else {\n echo gt('File was NOT uploaded!');\n// flash('error',gt('File was not uploaded!'));\n }\n } ", "label_name": "CWE-74", "label": "74"} -{"code": " function edit_externalalias() {\r\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\r\n if ($section->parent == -1) {\r\n notfoundController::handle_not_found();\r\n exit;\r\n } // doesn't work for standalone pages\r\n if (empty($section->id)) {\r\n $section->public = 1;\r\n if (!isset($section->parent)) {\r\n // This is another precaution. The parent attribute\r\n // should ALWAYS be set by the caller.\r\n //FJD - if that's the case, then we should die.\r\n notfoundController::handle_not_authorized();\r\n exit;\r\n //$section->parent = 0;\r\n }\r\n }\r\n assign_to_template(array(\r\n 'section' => $section,\r\n 'glyphs' => self::get_glyphs(),\r\n ));\r\n }\r", "label_name": "CWE-74", "label": "74"} -{"code": "\tpublic function formatItem( Article $article, $pageText = null ) {\n\t\t$item = $article->mTitle;\n\n\t\tif ( $pageText !== null ) {\n\t\t\t//Include parsed/processed wiki markup content after each item before the closing tag.\n\t\t\t$item .= $pageText;\n\t\t}\n\n\t\t$item = $this->getItemStart() . $item . $this->itemEnd;\n\n\t\t$item = $this->replaceTagParameters( $item, $article );\n\n\t\treturn $item;\n\t}", "label_name": "CWE-400", "label": "400"} -{"code": "\tfunction manage_vendors () {\n\t expHistory::set('viewable', $this->params);\n\t\t$vendor = new vendor();\n\t\t\n\t\t$vendors = $vendor->find('all');\n\t\tassign_to_template(array(\n 'vendors'=>$vendors\n ));\n\t}", "label_name": "CWE-74", "label": "74"} -{"code": " public function actionGetItems(){\n $sql = \n 'SELECT id, name as value \n FROM x2_templates \n WHERE name \n LIKE :qterm \n ORDER BY name ASC';\n\n $command = Yii::app()->db->createCommand($sql);\n $qterm = $_GET['term'].'%';\n $command->bindParam(\":qterm\", $qterm, PDO::PARAM_STR);\n $result = $command->queryAll();\n echo CJSON::encode($result); exit;\n }", "label_name": "CWE-20", "label": "20"} -{"code": "\tpublic function register()\n\t{\n\t\tJSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));\n\n\t\t// Get the application\n\t\t$app = JFactory::getApplication();\n\n\t\t// Get the form data.\n\t\t$data = $this->input->post->get('user', array(), 'array');\n\n\t\t// Get the model and validate the data.\n\t\t$model = $this->getModel('Registration', 'UsersModel');\n\n\t\t$form = $model->getForm();\n\n\t\tif (!$form)\n\t\t{\n\t\t\tJError::raiseError(500, $model->getError());\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$return = $model->validate($form, $data);\n\n\t\t// Check for errors.\n\t\tif ($return === false)\n\t\t{\n\t\t\t// Get the validation messages.\n\t\t\t$errors = $model->getErrors();\n\n\t\t\t// Push up to three validation messages out to the user.\n\t\t\tfor ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)\n\t\t\t{\n\t\t\t\tif ($errors[$i] instanceof Exception)\n\t\t\t\t{\n\t\t\t\t\t$app->enqueueMessage($errors[$i]->getMessage(), 'notice');\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$app->enqueueMessage($errors[$i], 'notice');\n\t\t\t}\n\n\t\t\t// Save the data in the session.\n\t\t\t$app->setUserState('users.registration.form.data', $data);\n\n\t\t\t// Redirect back to the registration form.\n\t\t\t$this->setRedirect('index.php?option=com_users&view=registration');\n\n\t\t\treturn false;\n\t\t}\n\n\t\t// Finish the registration.\n\t\t$return = $model->register($data);\n\n\t\t// Check for errors.\n\t\tif ($return === false)\n\t\t{\n\t\t\t// Save the data in the session.\n\t\t\t$app->setUserState('users.registration.form.data', $data);\n\n\t\t\t// Redirect back to the registration form.\n\t\t\t$message = JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError());\n\t\t\t$this->setRedirect('index.php?option=com_users&view=registration', $message, 'error');\n\n\t\t\treturn false;\n\t\t}\n\n\t\t// Flush the data from the session.\n\t\t$app->setUserState('users.registration.form.data', null);\n\n\t\treturn true;\n\t}", "label_name": "CWE-20", "label": "20"} -{"code": " _size ({ id, token }, done) {\n return this.client\n .get(`https://graph.instagram.com/${id}`)\n .qs({ fields: 'media_url' })\n .auth(token)\n .request((err, resp, body) => {\n if (err || resp.statusCode !== 200) {\n err = this._error(err, resp)\n logger.error(err, 'provider.instagram.size.error')\n return done(err)\n }\n\n getURLMeta(body.media_url)\n .then(({ size }) => done(null, size))\n .catch((err2) => {\n logger.error(err2, 'provider.instagram.size.error')\n done(err2)\n })\n })\n }", "label_name": "CWE-863", "label": "863"} -{"code": "DrawioFile.prototype.mergeFile=function(b,f,l,d){var u=!0;try{this.stats.fileMerged++;var t=this.getShadowPages(),D=b.getShadowPages();if(null!=D&&0 -1 ? firstSlash : string.length - 1);\n var t;\n\n // authority@ must come before /path or \\path\n if (pos > -1 && (slash === -1 || pos < slash)) {\n t = string.substring(0, pos).split(':');\n parts.username = t[0] ? URI.decode(t[0]) : null;\n t.shift();\n parts.password = t[0] ? URI.decode(t.join(':')) : null;\n string = string.substring(pos + 1);\n } else {\n parts.username = null;\n parts.password = null;\n }\n\n return string;\n };", "label_name": "CWE-20", "label": "20"} -{"code": "\"4px\";oa.style.margin=\"2px\";oa.style.border=\"1px solid black\";oa.style.background=ta&&\"none\"!=ta?ta:\"url('\"+Dialog.prototype.noColorImage+\"')\";btn=mxUtils.button(\"\",mxUtils.bind(Z,function(sa){this.editorUi.pickColor(ta,function(ya){oa.style.background=\"none\"==ya?\"url('\"+Dialog.prototype.noColorImage+\"')\":ya;T(Aa,ya,ka)});mxEvent.consume(sa)}));btn.style.height=\"12px\";btn.style.width=\"40px\";btn.className=\"geColorBtn\";btn.appendChild(oa);return btn}function R(Aa,ta,ka,oa,sa,ya,wa){null!=ta&&(ta=ta.split(\",\"),\naa.push({name:Aa,values:ta,type:ka,defVal:oa,countProperty:sa,parentRow:ya,isDeletable:!0,flipBkg:wa}));btn=mxUtils.button(\"+\",mxUtils.bind(Z,function(ua){for(var xa=ya,ha=0;null!=xa.nextSibling;)if(xa.nextSibling.getAttribute(\"data-pName\")==Aa)xa=xa.nextSibling,ha++;else break;var da={type:ka,parentRow:ya,index:ha,isDeletable:!0,defVal:oa,countProperty:sa};ha=ea(Aa,\"\",da,0==ha%2,wa);T(Aa,oa,da);xa.parentNode.insertBefore(ha,xa.nextSibling);mxEvent.consume(ua)}));btn.style.height=\"16px\";btn.style.width=\n\"25px\";btn.className=\"geColorBtn\";return btn}function Y(Aa,ta,ka,oa,sa,ya,wa){if(0T.indexOf(\"mxPageSelector\")&&0
    < '+mxResources.get(\"back\")+'
    '+", "label_name": "CWE-20", "label": "20"} -{"code": "O.scrollCellToVisible(O.getSelectionCell())}}}else{K=function(V){var M=H[V];null==M&&(M=new mxCell(V,new mxGeometry(0,0,80,30),\"whiteSpace=wrap;html=1;\"),M.vertex=!0,H[V]=M,z.push(M));return M};var H={};z=[];for(D=0;D\");2<=S.length&&(P=K(S[0]),F=K(S[S.length-1]),S=new mxCell(2=U.status&&(d(U.responseText,P,K,F,H,S,V,\"fixed\",mxEvent.isAltDown(D)?null:V.substring(0,V.lastIndexOf(\".\")).replace(/_/g,\" \")),x.scrollTop=x.scrollHeight))})):(b.spinner.stop(),b.showError(mxResources.get(\"error\"),mxResources.get(\"notInOffline\"))):(d(G,P,K,F,H,S,V,\"fixed\",mxEvent.isAltDown(D)?null:V.substring(0,V.lastIndexOf(\".\")).replace(/_/g,\" \")),x.scrollTop=x.scrollHeight)}};mxEvent.addListener(x,\"dragover\",g);", "label_name": "CWE-20", "label": "20"} -{"code": "Menus.prototype.createPopupMenu=function(B,F,G){var N=this.editorUi.editor.graph;B.smartSeparators=!0;x.apply(this,arguments);\"1\"==urlParams.sketch?N.isEnabled()&&(B.addSeparator(),1==N.getSelectionCount()&&this.addMenuItems(B,[\"-\",\"lockUnlock\"],null,G)):1==N.getSelectionCount()?(N.isCellFoldable(N.getSelectionCell())&&this.addMenuItems(B,N.isCellCollapsed(F)?[\"expand\"]:[\"collapse\"],null,G),this.addMenuItems(B,[\"collapsible\",\"-\",\"lockUnlock\",\"enterGroup\"],null,G),B.addSeparator(),this.addSubmenu(\"layout\",\nB)):N.isSelectionEmpty()&&N.isEnabled()?(B.addSeparator(),this.addMenuItems(B,[\"editData\"],null,G),B.addSeparator(),this.addSubmenu(\"layout\",B),this.addSubmenu(\"insert\",B),this.addMenuItems(B,[\"-\",\"exitGroup\"],null,G)):N.isEnabled()&&this.addMenuItems(B,[\"-\",\"lockUnlock\"],null,G)};var A=Menus.prototype.addPopupMenuEditItems;Menus.prototype.addPopupMenuEditItems=function(B,F,G){A.apply(this,arguments);this.editorUi.editor.graph.isSelectionEmpty()&&this.addMenuItems(B,[\"copyAsImage\"],null,G)};EditorUi.prototype.toggleFormatPanel=", "label_name": "CWE-20", "label": "20"} -{"code": " function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {\n var inputExpressions = parsedExpression.inputs;\n var lastResult;\n\n if (inputExpressions.length === 1) {\n var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails\n inputExpressions = inputExpressions[0];\n return scope.$watch(function expressionInputWatch(scope) {\n var newInputValue = inputExpressions(scope);\n if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {\n lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);\n oldInputValueOf = newInputValue && getValueOf(newInputValue);\n }\n return lastResult;\n }, listener, objectEquality, prettyPrintExpression);\n }\n\n var oldInputValueOfValues = [];\n var oldInputValues = [];\n for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails\n oldInputValues[i] = null;\n }\n\n return scope.$watch(function expressionInputsWatch(scope) {\n var changed = false;\n\n for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n var newInputValue = inputExpressions[i](scope);\n if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {\n oldInputValues[i] = newInputValue;\n oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);\n }\n }\n\n if (changed) {\n lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);\n }\n\n return lastResult;\n }, listener, objectEquality, prettyPrintExpression);\n }", "label_name": "CWE-74", "label": "74"} -{"code": "v.apply(this,arguments)};m.getLinkForCell=function(){return null};var x=m.view.getState(q);k=m.getAllConnectionConstraints(x);for(var A=0;null!=k&&Ab._index||1>b._length||b._index-b._length||1>b._match||1>b.Y||9999b.M||12b.D||b.D>e||0>b.H||23b.m||59b.s||59b.S||999\nb.Z||840a.Y?22801:1,b||a.Z?new Date(Date.UTC(a.Y,a.M,a.D,a.H,a.m+a.Z,a.s,a.S)):new Date(a.Y,a.M,a.D,a.H,a.m,a.s,a.S)):new Date(NaN)};d.transform=function(a,c,b,e){return d.format(d.parse(a,c),b,e)};d.addYears=function(a,c){return d.addMonths(a,12*c)};d.addMonths=function(a,c){var b=new Date(a.getTime());b.setMonth(b.getMonth()+c);return b};d.addDays=function(a,c){var b=new Date(a.getTime());b.setDate(b.getDate()+c);return b};", "label_name": "CWE-400", "label": "400"} -{"code": "mxDualRuler.prototype.setUnit=function(b){this.vRuler.setUnit(b);this.hRuler.setUnit(b)};mxDualRuler.prototype.setStyle=function(b){this.vRuler.setStyle(b);this.hRuler.setStyle(b)};mxDualRuler.prototype.destroy=function(){this.vRuler.destroy();this.hRuler.destroy();this.ui.refresh=this.editorUiRefresh;mxGuide.prototype.move=this.origGuideMove;mxGuide.prototype.destroy=this.origGuideDestroy;this.ui.getDiagramContainerOffset=this.editorUiGetDiagContOffset};function mxFreehand(b){var f=null!=b.view&&null!=b.view.canvas?b.view.canvas.ownerSVGElement:null;if(null!=b.container&&null!=f){b.addListener(mxEvent.ESCAPE,mxUtils.bind(this,function(){this.stopDrawing()}));var l=mxFreehand.prototype.NORMAL_SMOOTHING,d=null,u=[],t,D=[],c,e=!1,g=!0,k=!0,m=!0,q=!0,v=[],x=!1,A=!0,z=!1,L={size:12,thinning:.5,smoothing:.5,streamline:.5,start:{taper:0,cap:!0},end:{taper:0,cap:!0}},M=!1;this.setClosedPath=function(J){e=J};this.setAutoClose=function(J){g=J};this.setAutoInsert=", "label_name": "CWE-20", "label": "20"} -{"code": "g()?\"\":Editor.isDarkMode()?\"#ff0000\":\"#ffcfcf\"}catch(U){b.handleError(U)}});K.setAttribute(\"title\",mxResources.get(\"find\")+\" (Enter)\");K.style.float=\"none\";K.style.width=\"120px\";K.style.marginTop=\"6px\";K.style.marginLeft=\"8px\";K.style.overflow=\"hidden\";K.style.textOverflow=\"ellipsis\";K.className=\"geBtn gePrimaryBtn\";t.appendChild(K);var F=document.createElement(\"div\");F.style.marginTop=\"10px\";if(n){var H=function(U,X,u,E,J){if(null==J||\"1\"!=J.html)return E=U.toLowerCase().indexOf(X,E),0>E?U:U.substr(0,\nE)+u+U.substr(E+X.length);var T=U;X=mxUtils.htmlEntities(X);J=[];var N=-1;for(U=U.replace(/
    /ig,\"\\n\");-1<(N=U.indexOf(\"<\",N+1));)J.push(N);N=U.match(/<[^>]*>/g);U=U.replace(/<[^>]*>/g,\"\");E=U.toLowerCase().indexOf(X,E);if(0>E)return T;T=E+X.length;u=mxUtils.htmlEntities(u);U=U.substr(0,E)+u+U.substr(T);for(var Q=0,R=0;R\")},S=mxUtils.button(mxResources.get(\"replFind\"),function(){try{if(null!=A&&null!=q&&L.value){var U=q.cell,X=l.getLabel(U);l.isCellEditable(U)&&l.model.setValue(U,H(X,A,L.value,B-A.length,l.getCurrentCellStyle(U)));z.style.backgroundColor=g(!1,!0)?\"\":Editor.isDarkMode()?\"#ff0000\":\"#ffcfcf\"}}catch(u){b.handleError(u)}});S.setAttribute(\"title\",mxResources.get(\"replFind\"));S.style.float=\"none\";S.style.width=\"120px\";S.style.marginTop=\"6px\";S.style.marginLeft=\"8px\";S.style.overflow=\"hidden\";S.style.textOverflow=", "label_name": "CWE-20", "label": "20"} -{"code": " function addAttribute(mainTemplate, elName, source, chunk) {\n const outputOptions = this.compilation.outputOptions || mainTemplate.outputOptions;\n if (!outputOptions.crossOriginLoading) {\n this.sriPlugin.errorOnce(\n this.compilation,\n 'webpack option output.crossOriginLoading not set, code splitting will not work!'\n );\n }\n return (Template.asString || mainTemplate.asString)([\n source,\n elName + '.integrity = __webpack_require__.sriHashes[' + (chunk ? `'${chunk.id}'` : 'chunkId') + '];',\n elName + '.crossOrigin = ' + JSON.stringify(outputOptions.crossOriginLoading) + ';',\n ]);\n };", "label_name": "CWE-345", "label": "345"} -{"code": "\"1\"==urlParams.embed&&(d.actions.get(\"save\").funct=function(n){u.isEditing()&&u.stopEditing();var y=\"0\"!=urlParams.pages||null!=d.pages&&1=Ga.getStatus()&&(qa=Ga.getText());Ja(qa)}))):Ja(qa)}function ma(na,Ja,Ga){if(null!=na&&mxUtils.isAncestorNode(document.body,ca)&&(na=mxUtils.parseXml(na),na=Editor.extractGraphModel(na.documentElement,!0),null!=na)){\"mxfile\"==", "label_name": "CWE-20", "label": "20"} -{"code": "mxEvent.getClientX(za);I.popupMenuHandler.hideMenu();mxEvent.consume(za)});mxEvent.addGestureListeners(document.body,null,function(za){var wa=!1;null!=Ma&&(U.diagramContainer.style.width=Math.max(20,Qa+mxEvent.getClientX(za)-Ma)+\"px\",wa=!0);null!=Oa&&(U.diagramContainer.style.height=Math.max(20,Ta+mxEvent.getClientY(za)-Oa)+\"px\",wa=!0);wa&&((window.opener||window.parent).postMessage(JSON.stringify({event:\"resize\",fullscreen:Editor.inlineFullscreen,rect:U.diagramContainer.getBoundingClientRect()}),\n\"*\"),Z(),U.refresh())},function(za){null==Ma&&null==Oa||mxEvent.consume(za);Oa=Ma=null});this.diagramContainer.style.borderRadius=\"4px\";document.body.style.backgroundColor=\"transparent\";U.bottomResizer.style.visibility=\"hidden\";U.rightResizer.style.visibility=\"hidden\";P.style.visibility=\"hidden\";W.style.visibility=\"hidden\";S.style.display=\"none\"}\"1\"==urlParams.prefetchFonts&&U.editor.loadFonts()}}};", "label_name": "CWE-20", "label": "20"} -{"code": "S&&S(M)}}))}catch(L){null!=S&&S(L)}}),N,sa)}catch(Pa){null!=S&&S(Pa)}};Editor.crcTable=[];for(var D=0;256>D;D++)for(var t=D,F=0;8>F;F++)t=1==(t&1)?3988292384^t>>>1:t>>>1,Editor.crcTable[D]=t;Editor.updateCRC=function(u,J,N,W){for(var S=0;S>>8;return u};Editor.crc32=function(u){for(var J=-1,N=0;N>>8^Editor.crcTable[(J^u.charCodeAt(N))&255];return(J^-1)>>>0};Editor.writeGraphModelToPng=function(u,J,N,W,S){function P(sa,Ba){var ta=\nva;va+=Ba;return sa.substring(ta,va)}function Z(sa){sa=P(sa,4);return sa.charCodeAt(3)+(sa.charCodeAt(2)<<8)+(sa.charCodeAt(1)<<16)+(sa.charCodeAt(0)<<24)}function oa(sa){return String.fromCharCode(sa>>24&255,sa>>16&255,sa>>8&255,sa&255)}u=u.substring(u.indexOf(\",\")+1);u=window.atob?atob(u):Base64.decode(u,!0);var va=0;if(P(u,8)!=String.fromCharCode(137)+\"PNG\"+String.fromCharCode(13,10,26,10))null!=S&&S();else if(P(u,4),\"IHDR\"!=P(u,4))null!=S&&S();else{P(u,17);S=u.substring(0,va);do{var Aa=Z(u);if(\"IDAT\"==", "label_name": "CWE-20", "label": "20"} -{"code": "\tcomputedMember: function (left, right) {\n\t\treturn left + \"[\" + right + \"]\";\n\t},", "label_name": "CWE-74", "label": "74"} -{"code": "this.startDrawing=function(){n(!0)};this.isDrawing=function(){return x};var y=mxUtils.bind(this,function(J){if(d){var E=c.length,H=A&&0c.length;H||D.push.apply(D,c);c=[];D.push(null);u.push(d);d=null;(H||k)&&this.stopDrawing();k&&2<=E&&this.startDrawing();mxEvent.consume(J)}}),K=new mxCell;K.edge=!0;var B=function(){var J=b.getCurrentCellStyle(K);J=mxUtils.getValue(b.currentVertexStyle,mxConstants.STYLE_STROKECOLOR,mxUtils.getValue(J,mxConstants.STYLE_STROKECOLOR,\"#000\"));\"default\"==", "label_name": "CWE-20", "label": "20"} -{"code": "\"checked\"),M.style.visibility=\"visible\"):A.setAttribute(\"checked\",\"checked\")):l=null}else l=null}catch(I){}v.style=x+(l?l:u());v.vertex=!0;k.addCell(v,null,null,null,null);k.selectAll();k.addListener(mxEvent.CELLS_MOVED,B);k.addListener(mxEvent.CELLS_RESIZED,B);var X=k.graphHandler.mouseUp,p=k.graphHandler.mouseDown;k.graphHandler.mouseUp=function(){X.apply(this,arguments);g.style.backgroundColor=\"#fff9\"};k.graphHandler.mouseDown=function(){p.apply(this,arguments);g.style.backgroundColor=\"\"};k.dblClick=", "label_name": "CWE-20", "label": "20"} -{"code": "u[E]}catch(J){null!=window.console&&console.log(\"Error in vars URL parameter: \"+J)}};Graph.prototype.getExportVariables=function(){return null!=this.globalVars?mxUtils.clone(this.globalVars):{}};var z=Graph.prototype.getGlobalVariable;Graph.prototype.getGlobalVariable=function(u){var E=z.apply(this,arguments);null==E&&null!=this.globalVars&&(E=this.globalVars[u]);return E};Graph.prototype.getDefaultStylesheet=function(){if(null==this.defaultStylesheet){var u=this.themes[\"default-style2\"];this.defaultStylesheet=", "label_name": "CWE-20", "label": "20"} -{"code": "function pa(){mxEllipse.call(this)}function ua(){mxEllipse.call(this)}function ya(){mxRhombus.call(this)}function Fa(){mxEllipse.call(this)}function Ma(){mxEllipse.call(this)}function Oa(){mxEllipse.call(this)}function Qa(){mxEllipse.call(this)}function Ta(){mxActor.call(this)}function za(){mxActor.call(this)}function wa(){mxActor.call(this)}function Ea(c,l,x,p){mxShape.call(this);this.bounds=c;this.fill=l;this.stroke=x;this.strokewidth=null!=p?p:1;this.rectStyle=\"square\";this.size=10;this.absoluteCornerSize=\n!0;this.indent=2;this.rectOutline=\"single\"}function Da(){mxConnector.call(this)}function La(c,l,x,p,v,A,B,ha,K,xa){B+=K;var na=p.clone();p.x-=v*(2*B+K);p.y-=A*(2*B+K);v*=B+K;A*=B+K;return function(){c.ellipse(na.x-v-B,na.y-A-B,2*B,2*B);xa?c.fillAndStroke():c.stroke()}}mxUtils.extend(b,mxShape);b.prototype.updateBoundsFromLine=function(){var c=null;if(null!=this.line)for(var l=0;l=k.scrollHeight-k.offsetHeight&&C()},mxEvent.addListener(k,\"scroll\",B))}),y)});t()};GitHubClient.prototype.logout=function(){this.clearPersistentToken();this.setUser(null);b=null}})();TrelloFile=function(b,e,f){DrawioFile.call(this,b,e);this.meta=f;this.saveNeededCounter=0};mxUtils.extend(TrelloFile,DrawioFile);TrelloFile.prototype.getHash=function(){return\"T\"+encodeURIComponent(this.meta.compoundId)};TrelloFile.prototype.getMode=function(){return App.MODE_TRELLO};TrelloFile.prototype.isAutosave=function(){return!0};TrelloFile.prototype.getTitle=function(){return this.meta.name};TrelloFile.prototype.isRenamable=function(){return!1};TrelloFile.prototype.getSize=function(){return this.meta.bytes};", "label_name": "CWE-20", "label": "20"} -{"code": "Ea.prototype.constraints=null;mxUtils.extend(Da,mxConnector);Da.prototype.origPaintEdgeShape=Da.prototype.paintEdgeShape;Da.prototype.paintEdgeShape=function(c,l,x){for(var p=[],v=0;vthis.status)if(\"txt\"==g)k(this.response);else{var A=new FileReader;A.readAsDataURL(this.response);A.onloadend=function(B){var I=new Image;I.onload=\nfunction(){try{var O=I.width,t=I.height;if(0==O&&0==t){var z=A.result,L=z.indexOf(\",\"),C=decodeURIComponent(escape(atob(z.substring(L+1)))),D=mxUtils.parseXml(C).getElementsByTagName(\"svg\");0f.length?\"preview\":\"openInNewWindow\"),function(){var v=5E5>f.length?k.value:f;if(null!=u)u(v);else if(g)try{var x=b.openLink(v);null!=x&&(null==l||0=f){var H=0,S=0,V,M=0;for(V=K;V=na.getStatus()?la(na.getText(),pa):ia()})):la(b.emptyDiagramXml,pa)},la=function(pa,na){y||b.hideDialog(!0);e(pa,na,qa,da)},ia=function(){A(mxResources.get(\"cannotLoad\"));ma()},ma=function(){J=qa;za.className=\"geTempDlgCreateBtn\";da&&(Ga.className=\"geTempDlgOpenBtn\")},\nqa=J;J=null;\"boolean\"!==typeof da&&(da=qa.isExternal&&p);1==ha?k(qa.url,qa):da?(Ga.className=\"geTempDlgOpenBtn geTempDlgBtnDisabled geTempDlgBtnBusy\",ca()):(za.className=\"geTempDlgCreateBtn geTempDlgBtnDisabled geTempDlgBtnBusy\",ha=null==b.mode||b.mode==App.MODE_GOOGLE||b.mode==App.MODE_BROWSER?mxResources.get(\"diagramName\"):mxResources.get(\"filename\"),ha=new FilenameDialog(b,b.defaultFilename+\".drawio\",mxResources.get(\"ok\"),ca,ha,function(pa){var na=null!=pa&&0 2 ? sliceArgs(arguments, 2) : [];\n if (isFunction(fn) && !(fn instanceof RegExp)) {\n return curryArgs.length\n ? function() {\n return arguments.length\n ? fn.apply(self, concat(curryArgs, arguments, 0))\n : fn.apply(self, curryArgs);\n }\n : function() {\n return arguments.length\n ? fn.apply(self, arguments)\n : fn.call(self);\n };\n } else {\n // In IE, native methods are not functions so they cannot be bound (note: they don't need to be).\n return fn;\n }\n}", "label_name": "CWE-74", "label": "74"} -{"code": "function(){A()}),1E3)});mxEvent.addListener(q,\"click\",mxUtils.bind(this,function(L){var M=mxEvent.getSource(L);M!=v&&M!=x?(null!=g&&g(),A(),mxEvent.consume(L)):z()}));window.setTimeout(mxUtils.bind(this,function(){mxUtils.setPrefixedStyle(q.style,\"transform\",\"translate(-50%,0%)\")}),500);window.setTimeout(z,3E4);m=!0}return m};EditorUi.prototype.setCurrentFile=function(c){null!=c&&(c.opened=new Date);this.currentFile=c};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isExportToCanvas=", "label_name": "CWE-20", "label": "20"} -{"code": "DotObject.prototype._fill = function (a, obj, v, mod) {\n var k = a.shift()\n\n if (a.length > 0) {\n obj[k] = obj[k] ||\n (this.useArray && isIndex(a[0]) ? [] : {})\n\n if (!isArrayOrObject(obj[k])) {\n if (this.override) {\n obj[k] = {}\n } else {\n if (!(isArrayOrObject(v) && isEmptyObject(v))) {\n throw new Error(\n 'Trying to redefine `' + k + '` which is a ' + typeof obj[k]\n )\n }\n\n return\n }\n }\n\n this._fill(a, obj[k], v, mod)\n } else {\n if (!this.override &&\n isArrayOrObject(obj[k]) && !isEmptyObject(obj[k])) {\n if (!(isArrayOrObject(v) && isEmptyObject(v))) {\n throw new Error(\"Trying to redefine non-empty obj['\" + k + \"']\")\n }\n\n return\n }\n\n obj[k] = _process(v, mod)\n }\n}", "label_name": "CWE-74", "label": "74"} -{"code": "!1;null!=H&&(S=\"1\"==x.getCurrentCellStyle(H).treeMoving);return S}function t(H){var S=!1;null!=H&&(H=A.getParent(H),S=x.view.getState(H),S=\"tree\"==(null!=S?S.style:x.getCellStyle(H)).containerType);return S}function D(H){var S=!1;null!=H&&(H=A.getParent(H),S=x.view.getState(H),x.view.getState(H),S=null!=(null!=S?S.style:x.getCellStyle(H)).childLayout);return S}function c(H){H=x.view.getState(H);if(null!=H){var S=x.getIncomingTreeEdges(H.cell);if(0H.getCenterX())return mxConstants.DIRECTION_WEST}}return mxConstants.DIRECTION_EAST}function e(H,S){S=null!=S?S:!0;x.model.beginUpdate();try{var U=x.model.getParent(H),Q=x.getIncomingTreeEdges(H),W=x.cloneCells([Q[0],H]);x.model.setTerminal(W[0],x.model.getTerminal(Q[0],", "label_name": "CWE-20", "label": "20"} -{"code": "l,x,p,v){l=Math.min(p,v/2);c.moveTo(0,0);c.lineTo(p-l,0);c.quadTo(p,0,p,v/2);c.quadTo(p,v,p-l,v);c.lineTo(0,v);c.close();c.end()};mxCellRenderer.registerShape(\"delay\",Ta);mxUtils.extend(za,mxActor);za.prototype.size=.2;za.prototype.redrawPath=function(c,l,x,p,v){l=Math.min(v,p);var A=Math.max(0,Math.min(l,l*parseFloat(mxUtils.getValue(this.style,\"size\",this.size))));l=(v-A)/2;x=l+A;var B=(p-A)/2;A=B+A;c.moveTo(0,l);c.lineTo(B,l);c.lineTo(B,0);c.lineTo(A,0);c.lineTo(A,l);c.lineTo(p,l);c.lineTo(p,x);\nc.lineTo(A,x);c.lineTo(A,v);c.lineTo(B,v);c.lineTo(B,x);c.lineTo(0,x);c.close();c.end()};mxCellRenderer.registerShape(\"cross\",za);mxUtils.extend(wa,mxActor);wa.prototype.size=.25;wa.prototype.redrawPath=function(c,l,x,p,v){l=Math.min(p,v/2);x=Math.min(p-l,Math.max(0,parseFloat(mxUtils.getValue(this.style,\"size\",this.size)))*p);c.moveTo(0,v/2);c.lineTo(x,0);c.lineTo(p-l,0);c.quadTo(p,0,p,v/2);c.quadTo(p,v,p-l,v);c.lineTo(x,v);c.close();c.end()};mxCellRenderer.registerShape(\"display\",wa);mxUtils.extend(Ea,", "label_name": "CWE-20", "label": "20"} -{"code": "null!=c&&null!=c.getTitle()&&c.getTitle()!=this.defaultFilename&&A.push(\"title=\"+encodeURIComponent(c.getTitle()));z&&1
    ';c=null!=c?\"&fetch=\"+encodeURIComponent(c):\"\";M(e,'