{"code": " function selectObjectBySql($sql) {\n //$logFile = \"C:\\\\xampp\\\\htdocs\\\\supserg\\\\tmp\\\\queryLog.txt\";\n //$lfh = fopen($logFile, 'a');\n //fwrite($lfh, $sql . \"\\n\"); \n //fclose($lfh); \n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return null;\n return mysqli_fetch_object($res);\n }", "label_name": "CWE-74", "label": 1}
{"code": "\tfunction show_vendor () {\n\t\t$vendor = new vendor();\n\t\t\n\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\t$vendor_title = $vendor->title;\n\t\t\t$state = new geoRegion($vendor->state);\n\t\t\t$vendor->state = $state->name;\n\t\t\t//Removed unnecessary fields\n\t\t\tunset(\n $vendor->title,\n $vendor->table,\n $vendor->tablename,\n $vendor->classname,\n $vendor->identifier\n );\n\t\t\n\t\t\tassign_to_template(array(\n 'vendor_title' => $vendor_title,\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}", "label_name": "CWE-74", "label": 1}
{"code": "\tprotected function replaceTagCount( $tag, $nr ) {\n\t\treturn str_replace( '%NR%', $nr, $tag );\n\t}", "label_name": "CWE-400", "label": 2}
{"code": " function preview()\n {\n if ($this->params['id'] == 0) { // we want the default editor\n $demo = new stdClass();\n $demo->id = 0;\n $demo->name = \"Default\";\n if ($this->params['editor'] == 'ckeditor') {\n $demo->skin = 'kama';\n } elseif ($this->params['editor'] == 'tinymce') {\n $demo->skin = 'lightgray';\n }\n } else {\n $demo = self::getEditorSettings($this->params['id'], $this->params['editor']);\n }\n assign_to_template(\n array(\n 'demo' => $demo,\n 'editor' => $this->params['editor']\n )\n );\n }", "label_name": "CWE-200", "label": 10}
{"code": "function test1Controller($hphpdOutput, $hphpdProcessId, $serverPort) {\n // Request a page so that the client can debug it.\n waitForClientToOutput($hphpdOutput, \"Waiting for server response\");\n $url = \"http://\".php_uname('n').':'.$serverPort.'/test1.php';\n echo \"Requesting test1.php\\n\";\n request(php_uname('n'), $serverPort, 'test1.php', 10); // ignore response\n\n // Let client run until script quits\n waitForClientToOutput($hphpdOutput, \"quit\");\n}", "label_name": "CWE-668", "label": 7}
{"code": "\t\t\t\tforeach ($aco_value_array as $aco_value) {\n\t\t\t\t\t$this->debug_text(\"shift_acl(): ACO Section Value: $aco_section_value ACO VALUE: $aco_value\");\n\t\t\t\t\t$aco_key = array_search($aco_value, $acl_array['aco'][$aco_section_value]);\n\n\t\t\t\t\tif ($aco_key !== FALSE) {\n\t\t\t\t\t\t$this->debug_text(\"shift_acl(): Removing ACO. ($aco_key)\");\n\t\t\t\t\t\tunset($acl_array['aco'][$aco_section_value][$aco_key]);\n\t\t\t\t\t\t$update = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->debug_text(\"shift_acl(): ACO doesn't exist, can't remove it.\");\n\t\t\t\t\t}\n\t\t\t\t}", "label_name": "CWE-863", "label": 11}
{"code": "\tstatic public function getCategoryName($_id = 0) {\n\n\t\tif ($_id != 0) {\n\t\t\t$stmt = Database::prepare(\"\n\t\t\t\tSELECT `name` FROM `\" . TABLE_PANEL_TICKET_CATS . \"` WHERE `id` = :id\"\n\t\t\t);\n\t\t\t$category = Database::pexecute_first($stmt, array('id' => $_id));\n\t\t\treturn $category['name'];\n\t\t}\n\t\treturn null;\n\t}", "label_name": "CWE-732", "label": 13}
{"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": 1}
{"code": "function XMLRPCaddResourceGroupPriv($name, $type, $nodeid, $permissions){\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 $perms = explode(':', $permissions);\n updateResourcePrivs(\"$type/$name\", $nodeid, $perms, array());\n return array('status' => 'success');\n } else {\n return array('status' => 'error',\n 'errorcode' => 56,\n 'errormsg' => 'Invalid resource type');\n }\n}", "label_name": "CWE-20", "label": 0}
{"code": " function fread($handle, $length)\n {\n if (\\yiiunit\\framework\\base\\SecurityTest::$fread !== null) {\n return \\yiiunit\\framework\\base\\SecurityTest::$fread;\n }\n if (\\yiiunit\\framework\\base\\SecurityTest::$fopen !== null) {\n return $length < 8 ? \\str_repeat('s', $length) : 'test1234';\n }\n\n return \\fread($handle, $length);\n }", "label_name": "CWE-330", "label": 12}
{"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": 10}
{"code": " private function isWindows()\n {\n return DIRECTORY_SEPARATOR !== '/';\n }", "label_name": "CWE-330", "label": 12}
{"code": " $loc = expCore::makeLocation('navigation', '', $standalone->id);\r\n if (expPermissions::check('manage', $loc)) return true;\r\n }\r\n return false;\r\n }\r", "label_name": "CWE-74", "label": 1}
{"code": " foreach($item->attributes as $name => $value)\n if ($name !== 'id' && $name !== 'listId')\n $copy->$name = $value;\n $lineItems[] = $copy;\n }\n return $lineItems;\n }", "label_name": "CWE-20", "label": 0}
{"code": " public function save()\n {\n $project = $this->getProject();\n\n $values = $this->request->getValues();\n list($valid, $errors) = $this->categoryValidator->validateCreation($values);\n\n if ($valid) {\n if ($this->categoryModel->create($values) !== false) {\n $this->flash->success(t('Your category have been created successfully.'));\n $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true);\n return;\n } else {\n $errors = array('name' => array(t('Another category with the same name exists in this project')));\n }\n }\n\n $this->create($values, $errors);\n }", "label_name": "CWE-200", "label": 10}
{"code": " public function shouldRun(DateTime $date)\n {\n global $timedate;\n\n $runDate = clone $date;\n $this->handleTimeZone($runDate);\n\n $cron = Cron\\CronExpression::factory($this->schedule);\n if (empty($this->last_run) && $cron->isDue($runDate)) {\n return true;\n }\n\n $lastRun = $this->last_run ? $timedate->fromDb($this->last_run) : $timedate->fromDb($this->date_entered);\n \n $this->handleTimeZone($lastRun);\n $next = $cron->getNextRunDate($lastRun);\n\n return $next <= $runDate;\n }", "label_name": "CWE-863", "label": 11}
{"code": "\t\t\t\t$fieldPickListValues[$value] = \\App\\Language::translate($value, $this->getModuleName(),false,false);\n\t\t\t}\n\t\t\t// Protection against deleting a value that does not exist on the list\n\t\t\tif ('picklist' === $fieldDataType) {\n\t\t\t\t$fieldValue = $this->get('fieldvalue');\n\t\t\t\tif (!empty($fieldValue) && !isset($fieldPickListValues[$fieldValue])) {\n\t\t\t\t\t$fieldPickListValues[$fieldValue] = \\App\\Language::translate($fieldValue, $this->getModuleName(),false,false);\n\t\t\t\t\t$this->set('isEditableReadOnly', true);\n\t\t\t\t}\n\t\t\t}\n\t\t} elseif (method_exists($this->getUITypeModel(), 'getPicklistValues')) {", "label_name": "CWE-20", "label": 0}
{"code": " public function remove()\n {\n $this->checkCSRFParam();\n $project = $this->getProject();\n $tag_id = $this->request->getIntegerParam('tag_id');\n $tag = $this->tagModel->getById($tag_id);\n\n if ($tag['project_id'] != $project['id']) {\n throw new AccessForbiddenException();\n }\n\n if ($this->tagModel->remove($tag_id)) {\n $this->flash->success(t('Tag removed successfully.'));\n } else {\n $this->flash->failure(t('Unable to remove this tag.'));\n }\n\n $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));\n }", "label_name": "CWE-200", "label": 10}
{"code": " public function create_directory() {\n if (!AuthUser::hasPermission('file_manager_mkdir')) {\n Flash::set('error', __('You do not have sufficient permissions to create a directory.'));\n redirect(get_url('plugin/file_manager/browse/'));\n }\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/create_directory')) {\n Flash::set('error', __('Invalid CSRF token found!'));\n redirect(get_url('plugin/file_manager/browse/'));\n }\n }\n else {\n Flash::set('error', __('No CSRF token found!'));\n redirect(get_url('plugin/file_manager/browse/'));\n }\n\n $data = $_POST['directory'];\n\n $path = str_replace('..', '', $data['path']);\n $dirname = str_replace('..', '', $data['name']);\n $dir = FILES_DIR . \"/{$path}/{$dirname}\";\n\n if (mkdir($dir)) {\n $mode = Plugin::getSetting('dirmode', 'file_manager');\n chmod($dir, octdec($mode));\n } else {\n Flash::set('error', __('Directory :name has not been created!', array(':name' => $dirname)));\n }\n redirect(get_url('plugin/file_manager/browse/' . $path));\n }", "label_name": "CWE-20", "label": 0}
{"code": " protected function generateCookieHash($class, $username, $expires, $password)\n {\n return hash_hmac('sha256', $class.$username.$expires.$password, $this->getSecret());\n }", "label_name": "CWE-287", "label": 4}
{"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": 1}
{"code": "\tpublic function update_version() {\n\t // get the current version\n\t $hv = new help_version();\n\t $current_version = $hv->find('first', 'is_current=1');\n\t \n\t // check to see if the we have a new current version and unset the old current version.\n\t if (!empty($this->params['is_current'])) {\n//\t $db->sql('UPDATE '.DB_TABLE_PREFIX.'_help_version set is_current=0');\n help_version::clearHelpVersion();\n\t }\n\t expSession::un_set('help-version');\n\n\t // save the version\n\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $version = new help_version();\n\t // if we don't have a current version yet so we will force this one to be it\n\t if (empty($current_version->id)) $this->params['is_current'] = 1;\n\t $version->update($this->params);\n\t \n\t // if this is a new version we need to copy over docs\n\t if (empty($id)) {\n\t self::copydocs($current_version->id, $version->id);\t \n\t }\n // let's update the search index to reflect the current help version\n searchController::spider();\n\n\t flash('message', gt('Saved help version').' '.$version->version);\n\t expHistory::back();\n\t}", "label_name": "CWE-74", "label": 1}
{"code": "\tpublic function Insert() {\n\n\t\t$ins_stmt = Database::prepare(\"\n\t\t\tINSERT INTO `\" . TABLE_PANEL_TICKETS . \"` SET\n `customerid` = :customerid,\n `adminid` = :adminid,\n `category` = :category,\n `priority` = :priority,\n `subject` = :subject,\n `message` = :message,\n `dt` = :dt,\n `lastchange` = :lastchange,\n `ip` = :ip,\n `status` = :status,\n `lastreplier` = :lastreplier,\n `by` = :by,\n `answerto` = :answerto\"\n\t\t);\n\t\t$ins_data = array(\n\t\t\t'customerid' => $this->Get('customer'),\n\t\t\t'adminid' => $this->Get('admin'),\n\t\t\t'category' => $this->Get('category'),\n\t\t\t'priority' => $this->Get('priority'),\n\t\t\t'subject' => $this->Get('subject'),\n\t\t\t'message' => $this->Get('message'),\n\t\t\t'dt' => time(),\n\t\t\t'lastchange' => time(),\n\t\t\t'ip' => $this->Get('ip'),\n\t\t\t'status' => $this->Get('status'),\n\t\t\t'lastreplier' => $this->Get('lastreplier'),\n\t\t\t'by' => $this->Get('by'),\n\t\t\t'answerto' => $this->Get('answerto')\n\t\t);\n\t\tDatabase::pexecute($ins_stmt, $ins_data);\n\t\t$this->tid = Database::lastInsertId();\n\t\treturn true;\n\t}", "label_name": "CWE-732", "label": 13}
{"code": " private static function sign($input, $key, $algo = 'HS256')\n {\n switch ($algo) {\n\n case 'HS256':\n return hash_hmac('sha256', $input, $key, true);\n\n case 'HS384':\n return hash_hmac('sha384', $input, $key, true);\n\n case 'HS512':\n return hash_hmac('sha512', $input, $key, true);\n\n case 'RS256':\n return JWT::generateRSASignature($input, $key, OPENSSL_ALGO_SHA256);\n\n case 'RS384':\n return JWT::generateRSASignature($input, $key, OPENSSL_ALGO_SHA384);\n\n case 'RS512':\n return JWT::generateRSASignature($input, $key, OPENSSL_ALGO_SHA512);\n\n default:\n throw new Exception(\"Unsupported or invalid signing algorithm.\");\n }\n }", "label_name": "CWE-20", "label": 0}
{"code": " foreach ($week as $dayNum => $day) {\r\n if ($dayNum == $now['mday']) {\r\n $currentweek = $weekNum;\r\n }\r\n if ($dayNum <= $endofmonth) {\r\n// $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $db->countObjects(\"eventdate\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($day['ts']) . \" AND date <= \" . expDateTime::endOfDayTimestamp($day['ts'])) : -1;\r\n $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $ed->find(\"count\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($day['ts']) . \" AND date <= \" . expDateTime::endOfDayTimestamp($day['ts'])) : -1;\r\n }\r\n }\r", "label_name": "CWE-74", "label": 1}
{"code": " } elseif (!empty($this->params['src'])) {\r\n if ($this->params['src'] == $loc->src) {\r\n $this->config = $config->config;\r\n break;\r\n }\r\n }\r\n }\r", "label_name": "CWE-74", "label": 1}
{"code": " public function update()\n {\n $project = $this->getProject();\n\n $values = $this->request->getValues();\n list($valid, $errors) = $this->swimlaneValidator->validateModification($values);\n\n if ($valid) {\n if ($this->swimlaneModel->update($values['id'], $values)) {\n $this->flash->success(t('Swimlane updated successfully.'));\n return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));\n } else {\n $errors = array('name' => array(t('Another swimlane with the same name exists in the project')));\n }\n }\n\n return $this->edit($values, $errors);\n }", "label_name": "CWE-200", "label": 10}
{"code": "function XMLRPCremoveUserGroupPriv($name, $affiliation, $nodeid, $permissions){\n require_once(\".ht-inc/privileges.php\");\n\tglobal $user;\n\n if(! checkUserHasPriv(\"userGrant\", $user['id'], $nodeid)){\n\t\treturn array('status' => 'error',\n 'errorcode' => 53,\n 'errormsg' => 'Unable to remove group privileges on this node');\n }\n\n\t$validate = array('name' => $name,\n\t 'affiliation' => $affiliation);\n\t$rc = validateAPIgroupInput($validate, 1);\n\tif($rc['status'] == 'error')\n\t\treturn $rc;\n\n $groupid = $rc['id'];\n $groupname = \"$name@$affiliation\";\n $perms = explode(':', $permissions);\n $usertypes = getTypes('users');\n array_push($usertypes[\"users\"], \"block\");\n\tarray_push($usertypes[\"users\"], \"cascade\");\n $cascadePrivs = getNodeCascadePriviliges($nodeid, \"usergroups\");\n $removegroupprivs = array();\n if(array_key_exists($groupname, $cascadePrivs['usergroups'])){\n foreach($perms as $permission){\n if(in_array($permission, $cascadePrivs['usergroups'][$groupname]['privs'])){\n array_push($removegroupprivs, $permission);\n }\n }\n $diff = array_diff($cascadePrivs['usergroups'][$groupname], $removegroupprivs);\n if(count($diff) == 1 && in_array(\"cascade\", $diff)){\n array_push($removegroupprivs, \"cascade\");\n\t}\n\t}\n if(empty($removegroupprivs)){\n\t\treturn array('status' => 'error',\n 'errorcode' => 53,\n 'errormsg' => 'Invalid or missing permissions list supplied');\n\t}\n\n updateUserOrGroupPrivs($groupid, $nodeid, array(), $removegroupprivs, \"group\");\n return array('status' => 'success');\n}", "label_name": "CWE-20", "label": 0}
{"code": "\t\tpublic function removeRemote($name)\n\t\t{\n\t\t\t$this->run('remote', 'remove', $name);\n\t\t\treturn $this;\n\t\t}", "label_name": "CWE-77", "label": 14}
{"code": " public function show()\n {\n $task = $this->getTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask_restriction/show', array(\n 'status_list' => array(\n SubtaskModel::STATUS_TODO => t('Todo'),\n SubtaskModel::STATUS_DONE => t('Done'),\n ),\n 'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label_name": "CWE-200", "label": 10}
{"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": 1}
{"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": 10}
{"code": " public function confirm()\n {\n $task = $this->getTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask/remove', array(\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label_name": "CWE-200", "label": 10}
{"code": " public function update()\n {\n $project = $this->getProject();\n $tag_id = $this->request->getIntegerParam('tag_id');\n $tag = $this->tagModel->getById($tag_id);\n $values = $this->request->getValues();\n list($valid, $errors) = $this->tagValidator->validateModification($values);\n\n if ($tag['project_id'] != $project['id']) {\n throw new AccessForbiddenException();\n }\n\n if ($valid) {\n if ($this->tagModel->update($values['id'], $values['name'])) {\n $this->flash->success(t('Tag updated successfully.'));\n } else {\n $this->flash->failure(t('Unable to update this tag.'));\n }\n\n $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));\n } else {\n $this->edit($values, $errors);\n }\n }", "label_name": "CWE-200", "label": 10}
{"code": "\tpublic function getPurchaseOrderByJSON() {\n\t\t\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\t\t\n\t\techo json_encode($purchase_orders);\n\t}", "label_name": "CWE-74", "label": 1}
{"code": " private function decryptContentEncryptionKey($private_key_or_secret) {\n switch ($this->header['alg']) {\n case 'RSA1_5':\n $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_PKCS1);\n $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key);\n break;\n case 'RSA-OAEP':\n $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_OAEP);\n $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key);\n break;\n case 'dir':\n $this->content_encryption_key = $private_key_or_secret;\n break;\n case 'A128KW':\n case 'A256KW':\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A256KW':\n throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported');\n default:\n throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm');\n }\n if (!$this->content_encryption_key) {\n # NOTE:\n # Not to disclose timing difference between CEK decryption error and others.\n # Mitigating Bleichenbacher Attack on PKCS#1 v1.5\n # ref.) http://inaz2.hatenablog.com/entry/2016/01/26/222303\n $this->generateContentEncryptionKey(null);\n }\n }", "label_name": "CWE-200", "label": 10}
{"code": " $emails[$u->email] = trim(user::getUserAttribution($u->id));\r\n }\r", "label_name": "CWE-74", "label": 1}
{"code": "\tprivate function _addcontribution( $option ) {\n\t\t$this->addTable( 'recentchanges', 'rc' );\n\n\t\t$field = 'rc.rc_actor';\n\n\t\t$this->addSelect(\n\t\t\t[\n\t\t\t\t'contribution'\t=> 'SUM(ABS(rc.rc_new_len - rc.rc_old_len))',\n\t\t\t\t'contributor'\t=> $field\n\t\t\t]\n\t\t);\n\t\t$this->addWhere(\n\t\t\t[\n\t\t\t\t$this->tableNames['page'] . '.page_id = rc.rc_cur_id'\n\t\t\t]\n\t\t);\n\t\t$this->addGroupBy( 'rc.rc_cur_id' );\n\t}", "label_name": "CWE-400", "label": 2}
{"code": " public function saveconfig() {\n global $db;\n\n if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n $conf = serialize($calc->parseConfig($this->params)); \n $calc->update(array('config'=>$conf));\n expHistory::back();\n }", "label_name": "CWE-74", "label": 1}
{"code": " $links[] = CHtml::link(CHtml::encode($tag->tag),array('/search/search','term'=>CHtml::encode($tag->tag)));", "label_name": "CWE-20", "label": 0}
{"code": " function update() {\r\n parent::update();\r\n expSession::clearAllUsersSessionCache('navigation');\r\n }\r", "label_name": "CWE-74", "label": 1}
{"code": " self::assertSame($shouldBePresent, $request->hasHeader('Authorization'));\n self::assertSame($shouldBePresent, $request->hasHeader('Cookie'));\n\n return new Response(200);\n }\n ]);", "label_name": "CWE-200", "label": 10}
{"code": " public function update_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);\n // find required shipping method if needed\n if ($this->params['required_shipping_calculator_id'] > 0) {\n $this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']];\n } else {\n $this->params['required_shipping_calculator_id'] = 0;\n }\n \n $discount->update($this->params);\n expHistory::back();\n }", "label_name": "CWE-74", "label": 1}
{"code": " public static function navtojson() {\r\n return json_encode(self::navhierarchy());\r\n }\r", "label_name": "CWE-74", "label": 1}
{"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": 0}
{"code": " public function confirm()\n {\n $project = $this->getProject();\n $swimlane = $this->getSwimlane();\n\n $this->response->html($this->helper->layout->project('swimlane/remove', array(\n 'project' => $project,\n 'swimlane' => $swimlane,\n )));\n }", "label_name": "CWE-200", "label": 10}
{"code": " private function getStateId(string $state, string $machine)\n {\n return $this->getContainer()->get(Connection::class)\n ->fetchColumn('\n SELECT LOWER(HEX(state_machine_state.id))\n FROM state_machine_state\n INNER JOIN state_machine\n ON state_machine.id = state_machine_state.state_machine_id\n AND state_machine.technical_name = :machine\n WHERE state_machine_state.technical_name = :state\n ', [\n 'state' => $state,\n 'machine' => $machine,\n ]);\n }", "label_name": "CWE-732", "label": 13}
{"code": " $product = X2Model::model('Products')->findByAttributes(array('name'=>$lineItem->name));\n if (isset($product))\n $lineItem->productId = $product->id;\n if(empty($lineItem->currency))\n\t\t\t\t$lineItem->currency = $defaultCurrency;\n\t\t\tif($lineItem->isPercentAdjustment) {\n\t\t\t\t$lineItem->adjustment = Fields::strToNumeric(\n $lineItem->adjustment,'percentage');\n\t\t\t} else {\n\t\t\t\t$lineItem->adjustment = Fields::strToNumeric(\n $lineItem->adjustment,'currency',$curSym);\n\t\t\t}\n\t\t\t$lineItem->price = Fields::strToNumeric($lineItem->price,'currency',$curSym);\n\t\t\t$lineItem->total = Fields::strToNumeric($lineItem->total,'currency',$curSym);\n\t\t}", "label_name": "CWE-20", "label": 0}
{"code": "\tpublic function execute(&$params) {\n\t\t$options = $this->config['options'];\n\n\t\t$action = new Actions;\n\n\t\t$action->subject = $this->parseOption('subject',$params);\n $action->dueDate = $this->parseOption('dueDate',$params);\n\t\t$action->actionDescription = $this->parseOption('description',$params);\n\t\t$action->priority = $this->parseOption('priority',$params);\n\t\t$action->visibility = $this->parseOption('visibility',$params);\n\n\t\tif(isset($params['model']))\n\t\t\t$action->assignedTo = $this->parseOption('assignedTo',$params);\n\n\t\t// if(isset($this->config['attributes']))\n\t\t\t// $this->setModelAttributes($action,$this->config['attributes'],$params);\n\n if ($action->save()) {\n return array (\n true,\n Yii::t('studio', \"View created action: \").$action->getLink ());\n } else {\n return array(false, array_shift($action->getErrors()));\n }\n\n\n\n\t\t// if($this->parseOption('reminder',$params)) {\n\t\t\t// $notif=new Notification;\n\t\t\t// $notif->modelType='Actions';\n\t\t\t// $notif->createdBy=Yii::app()->user->getName();\n\t\t\t// $notif->modelId=$model->id;\n\t\t\t// if($_POST['notificationUsers']=='me'){\n\t\t\t\t// $notif->user=Yii::app()->user->getName();\n\t\t\t// }else{\n\t\t\t\t// $notif->user=$model->assignedTo;\n\t\t\t// }\n\t\t\t// $notif->createDate=$model->dueDate-($_POST['notificationTime']*60);\n\t\t\t// $notif->type='action_reminder';\n\t\t\t// $notif->save();\n\t\t\t// if($_POST['notificationUsers']=='both' && Yii::app()->user->getName()!=$model->assignedTo){\n\t\t\t\t// $notif2=new Notification;\n\t\t\t\t// $notif2->modelType='Actions';\n\t\t\t\t// $notif2->createdBy=Yii::app()->user->getName();\n\t\t\t\t// $notif2->modelId=$model->id;\n\t\t\t\t// $notif2->user=Yii::app()->user->getName();\n\t\t\t\t// $notif2->createDate=$model->dueDate-($_POST['notificationTime']*60);\n\t\t\t\t// $notif2->type='action_reminder';\n\t\t\t\t// $notif2->save();\n\t\t\t// }\n\t\t// }\n\t}", "label_name": "CWE-20", "label": 0}
{"code": " return $fa->nameGlyph($icons, 'icon-');\r\n }\r\n } else {\r\n return array();\r\n }\r\n }\r", "label_name": "CWE-74", "label": 1}
{"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": 1}
{"code": " function generateAutoLoginLink($params){\n\n $dataRequest = array();\n $dataRequestAppend = array();\n\n // Destination ID\n if (isset($params['r'])){\n $dataRequest['r'] = $params['r'];\n $dataRequestAppend[] = '/(r)/'.rawurlencode(base64_encode($params['r']));\n }\n\n // User ID\n if (isset($params['u']) && is_numeric($params['u'])){\n $dataRequest['u'] = $params['u'];\n $dataRequestAppend[] = '/(u)/'.rawurlencode($params['u']);\n }\n\n // Username\n if (isset($params['l'])){\n $dataRequest['l'] = $params['l'];\n $dataRequestAppend[] = '/(l)/'.rawurlencode($params['l']);\n }\n\n if (!isset($params['l']) && !isset($params['u'])) {\n throw new Exception('Username or User ID has to be provided');\n }\n\n $ts = time() + $params['t'];\n\n // Expire time for link\n if (isset($params['t'])) {\n $dataRequest['t'] = $ts;\n $dataRequestAppend[] = '/(t)/'.rawurlencode($ts);\n }\n\n $hashValidation = sha1($params['secret_hash'].sha1($params['secret_hash'].implode(',', $dataRequest)));\n\n return $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect(\"user/autologin\") . \"/{$hashValidation}\".implode('', $dataRequestAppend);\n }", "label_name": "CWE-116", "label": 15}
{"code": " protected function prepareImport($model, $csvName) {\n $this->openX2 ('/admin/importModels?model='.ucfirst($model));\n $csv = implode(DIRECTORY_SEPARATOR, array(\n Yii::app()->basePath,\n 'tests',\n 'data',\n 'csvs',\n $csvName\n ));\n $this->type ('data', $csv);\n $this->clickAndWait (\"dom=document.querySelector ('input[type=\\\"submit\\\"]')\");\n $this->assertCsvUploaded ($csv);\n }", "label_name": "CWE-20", "label": 0}
{"code": "\t\tpublic function checkout($name)\n\t\t{\n\t\t\t$this->run('checkout', $name);\n\t\t\treturn $this;\n\t\t}", "label_name": "CWE-77", "label": 14}
{"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": 1}
{"code": " public function showall() {\r\n global $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 '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": 1}
{"code": " protected function markCompleted($endStatus, ServiceResponse $serviceResponse, $gatewayMessage)\n {\n parent::markCompleted($endStatus, $serviceResponse, $gatewayMessage);\n $this->createMessage(Message\\CreateCardResponse::class, $gatewayMessage);\n ErrorHandling::safeExtend($this->payment, 'onCardCreated', $serviceResponse);\n }", "label_name": "CWE-436", "label": 5}
{"code": "\tpublic function showall() {\n\t expHistory::set('viewable', $this->params);\n\t $hv = new help_version();\n\t //$current_version = $hv->find('first', 'is_current=1');\n\t $ref_version = $hv->find('first', 'version=\\''.$this->help_version.'\\'');\n\n // pagination parameter..hard coded for now.\t \n\t\t$where = $this->aggregateWhereClause();\n\t $where .= 'AND help_version_id='.(empty($ref_version->id)?'0':$ref_version->id);", "label_name": "CWE-74", "label": 1}
{"code": "\tprivate function readData() {\n\n\t\tif (isset($this->tid)\n\t\t\t&& $this->tid != - 1\n\t\t) {\n\t\t\t$_ticket_stmt = Database::prepare('\n\t\t\t\tSELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid'\n\t\t\t);\n\t\t\t$_ticket = Database::pexecute_first($_ticket_stmt, array('tid' => $this->tid));\n\n\t\t\t$this->Set('customer', $_ticket['customerid'], true, false);\n\t\t\t$this->Set('admin', $_ticket['adminid'], true, false);\n\t\t\t$this->Set('subject', $_ticket['subject'], true, false);\n\t\t\t$this->Set('category', $_ticket['category'], true, false);\n\t\t\t$this->Set('priority', $_ticket['priority'], true, false);\n\t\t\t$this->Set('message', $_ticket['message'], true, false);\n\t\t\t$this->Set('dt', $_ticket['dt'], true, false);\n\t\t\t$this->Set('lastchange', $_ticket['lastchange'], true, false);\n\t\t\t$this->Set('ip', $_ticket['ip'], true, false);\n\t\t\t$this->Set('status', $_ticket['status'], true, false);\n\t\t\t$this->Set('lastreplier', $_ticket['lastreplier'], true, false);\n\t\t\t$this->Set('by', $_ticket['by'], true, false);\n\t\t\t$this->Set('answerto', $_ticket['answerto'], true, false);\n\t\t\t$this->Set('archived', $_ticket['archived'], true, false);\n\t\t}\n\t}", "label_name": "CWE-732", "label": 13}
{"code": " protected function AddAnAddress($kind, $address, $name = '') {\n if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {\n $this->SetError($this->Lang('Invalid recipient array').': '.$kind);\n if ($this->exceptions) {\n throw new phpmailerException('Invalid recipient array: ' . $kind);\n }\n if ($this->SMTPDebug) {\n $this->edebug($this->Lang('Invalid recipient array').': '.$kind);\n }\n return false;\n }\n $address = trim($address);\n $name = trim(preg_replace('/[\\r\\n]+/', '', $name)); //Strip breaks and trim\n if (!$this->ValidateAddress($address)) {\n $this->SetError($this->Lang('invalid_address').': '. $address);\n if ($this->exceptions) {\n throw new phpmailerException($this->Lang('invalid_address').': '.$address);\n }\n if ($this->SMTPDebug) {\n $this->edebug($this->Lang('invalid_address').': '.$address);\n }\n return false;\n }\n if ($kind != 'Reply-To') {\n if (!isset($this->all_recipients[strtolower($address)])) {\n array_push($this->$kind, array($address, $name));\n $this->all_recipients[strtolower($address)] = true;\n return true;\n }\n } else {\n if (!array_key_exists(strtolower($address), $this->ReplyTo)) {\n $this->ReplyTo[strtolower($address)] = array($address, $name);\n return true;\n }\n }\n return false;\n}", "label_name": "CWE-20", "label": 0}
{"code": " public function settings_save() {\n AuthUser::load();\n if (!AuthUser::isLoggedIn()) {\n redirect(get_url('login'));\n } else if (!AuthUser::hasPermission('admin_edit')) {\n Flash::set('error', __('You do not have permission to access the requested page!'));\n redirect(get_url());\n }\n \n if (!isset($_POST['settings'])) {\n Flash::set('error', 'File Manager - ' . __('form was not posted.'));\n redirect(get_url('plugin/file_manager/settings'));\n } else {\n $settings = $_POST['settings'];\n\n if ($settings['umask'] == 0)\n $settings['umask'] = 0;\n elseif (!preg_match('/^0?[0-7]{3}$/', $settings['umask']))\n $settings['umask'] = 0;\n if (strlen($settings['umask']) === 3)\n $settings['umask'] = '0' . $settings['umask'];\n elseif (strlen($settings['umask']) !== 4 && $settings['umask'] != 0)\n $settings['umask'] = 0;\n\n if (!preg_match('/^0?[0-7]{3}$/', $settings['dirmode']))\n $settings['dirmode'] = '0755';\n if (strlen($settings['dirmode']) === 3)\n $settings['dirmode'] = '0' . $settings['dirmode'];\n\n if (!preg_match('/^0?[0-7]{3}$/', $settings['filemode']))\n $settings['filemode'] = '0755';\n if (strlen($settings['filemode']) === 3)\n $settings['filemode'] = '0' . $settings['filemode'];\n }\n\n if (Plugin::setAllSettings($settings, 'file_manager'))\n Flash::setNow('success', 'File Manager - ' . __('plugin settings saved.'));\n else\n Flash::setNow('error', 'File Manager - ' . __('plugin settings not saved!'));\n\n $this->display('file_manager/views/settings', array('settings' => $settings));\n }", "label_name": "CWE-20", "label": 0}
{"code": " public function getChart($renderer, $id, $store_in_session = true)\n {\n $c = null;\n $chart_data = null;\n if ($renderer != null && $store_in_session) {\n $session = new Tracker_Report_Session($renderer->report->id);\n $session->changeSessionNamespace(\"renderers.{$renderer->id}\");\n\n // look for the chart in the session\n $chart_data = $session->get(\"charts.$id\");\n }\n\n if (! $chart_data) {\n // not found. look in the db\n $dao = new GraphOnTrackersV5_ChartDao(CodendiDataAccess::instance());\n $chart_data = $dao->searchById($id)->getRow();\n }\n\n if ($chart_data) {\n if (! $renderer) {\n $report = null; //We don't know the report\n $renderer = Tracker_Report_RendererFactory::instance()->getReportRendererById($chart_data['report_graphic_id'], $report, $store_in_session);\n }\n if ($renderer) {\n $c = $this->instanciateChart($chart_data, $renderer, $store_in_session);\n }\n }\n return $c;\n }", "label_name": "CWE-862", "label": 8}
{"code": " Contacts::model()->deleteAll($criteria);\n }\n }\n echo $model->id;\n }\n }", "label_name": "CWE-20", "label": 0}
{"code": " $sloc = expCore::makeLocation('navigation', null, $section->id);\r\n // remove any manage permissions for this page and it's children\r\n // $db->delete('userpermission', \"module='navigationController' AND internal=\".$section->id);\r\n // $db->delete('grouppermission', \"module='navigationController' AND internal=\".$section->id);\r\n foreach ($allusers as $uid) {\r\n $u = user::getUserById($uid);\r\n expPermissions::grant($u, 'manage', $sloc);\r\n }\r\n foreach ($allgroups as $gid) {\r\n $g = group::getGroupById($gid);\r\n expPermissions::grantGroup($g, 'manage', $sloc);\r\n }\r\n }\r\n }\r", "label_name": "CWE-74", "label": 1}
{"code": "\t\t\t\t$item = trim( $item );\n\t\t\t\tif ( strpos( $item, '|-' ) === 0 ) {\n\t\t\t\t\t$item = explode( '|-', $item, 2 );\n\t\t\t\t\tif ( count( $item ) == 2 ) {\n\t\t\t\t\t\t$item = $item[1];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$rowsKey[$index] = $item;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( strlen( $item ) > 0 ) {\n\t\t\t\t\t$word = explode( \"\\n|\", $item );\n\t\t\t\t\tif ( isset( $word[0] ) && empty( $word[0] ) ) {\n\t\t\t\t\t\tarray_shift( $word );\n\t\t\t\t\t}\n\t\t\t\t\tif ( isset( $word[abs( $sortColumn ) - 1] ) ) {\n\t\t\t\t\t\t$test = trim( $word[abs( $sortColumn ) - 1] );\n\t\t\t\t\t\tif ( strpos( $test, '|' ) > 0 ) {\n\t\t\t\t\t\t\t$test = trim( explode( '|', $test )[1] );\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$rowsKey[$index] = $test;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->sort($rowsKey, $sortColumn);\n\t\t\t$newItems = [];\n\t\t\tforeach ( $rowsKey as $index => $val ) {\n\t\t\t\t$newItems[] = $items[$index];\n\t\t\t}\n\t\t\t$items = $newItems;\n\t\t}\n\n\t\treturn $this->listStart . $this->implodeItems( $items ) . $this->listEnd;\n\t}", "label_name": "CWE-400", "label": 2}
{"code": " public function manage_messages() {\n expHistory::set('manageable', $this->params);\n \n $page = new expPaginator(array(\n\t\t\t'model'=>'order_status_messages',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'body',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n\t\t\t//'columns'=>array('Name'=>'title')\n ));\n\n //eDebug($page);\n\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", "label_name": "CWE-74", "label": 1}
{"code": "\tpublic function Delete() {\n\n\t\t// Delete \"main\" ticket\n\t\t$del_stmt = Database::prepare('\n\t\t\tDELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid'\n\t\t);\n\t\tDatabase::pexecute($del_stmt, array('tid' => $this->tid));\n\n\t\t// Delete \"answers\" to ticket\"\n\t\t$del_stmt = Database::prepare('\n\t\t\tDELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto` = :tid'\n\t\t);\n\t\tDatabase::pexecute($del_stmt, array('tid' => $this->tid));\n\t\treturn true;\n\t}", "label_name": "CWE-732", "label": 13}
{"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": 12}
{"code": "function barcode_encode($code,$encoding)\n{\n global $genbarcode_loc;\n\n if (\n ((preg_match(\"/^ean$/i\", $encoding)\n && ( strlen($code)==12 || strlen($code)==13)))\n\n || (($encoding) && (preg_match(\"/^isbn$/i\", $encoding))\n && (( strlen($code)==9 || strlen($code)==10) ||\n (((preg_match(\"/^978/\", $code) && strlen($code)==12) ||\n (strlen($code)==13)))))\n\n || (( !isset($encoding) || !$encoding || (preg_match(\"/^ANY$/i\", $encoding) ))\n && (preg_match(\"/^[0-9]{12,13}$/\", $code)))\n )\n {\n /* use built-in EAN-Encoder */\n dol_syslog(\"barcode.lib.php::barcode_encode Use barcode_encode_ean\");\n $bars=barcode_encode_ean($code, $encoding);\n }\n else if (file_exists($genbarcode_loc))\n {\n /* use genbarcode */\n dol_syslog(\"barcode.lib.php::barcode_encode Use genbarcode \".$genbarcode_loc.\" code=\".$code.\" encoding=\".$encoding);\n $bars=barcode_encode_genbarcode($code, $encoding);\n }\n else\n {\n print \"barcode_encode needs an external programm for encodings other then EAN/ISBN
\\n\";\n print \"