code
stringlengths 41
2.04k
| label_name
stringclasses 2
values | label
int64 0
1
|
---|---|---|
public function action_edge_mode_enable() {
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/activation.php');
$config_path = w3_get_wp_config_path();
$config_data = @file_get_contents($config_path);
if ($config_data === false)
return;
$new_config_data = $this->wp_config_evaluation_mode_remove_from_content($config_data);
$new_config_data = preg_replace(
'~<\?(php)?~',
"\\0\r\n" . $this->wp_config_evaluation_mode(),
$new_config_data,
1);
if ($new_config_data != $config_data) {
try {
w3_wp_write_to_file($config_path, $new_config_data);
} catch (FilesystemOperationException $ex) {
throw new FilesystemModifyException(
$ex->getMessage(), $ex->credentials_form(),
'Edit file <strong>' . $config_path .
'</strong> and add the next lines:', $config_path,
$this->wp_config_evaluation_mode());
}
try {
$this->_config_admin->set('notes.edge_mode', false);
$this->_config_admin->save();
} catch (Exception $ex) {}
}
w3_admin_redirect(array('w3tc_note' => 'enabled_edge'));
} | CWE-352 | 0 |
static function cronCheckUpdate($task) {
$result = Toolbox::checkNewVersionAvailable(1);
$task->log($result);
return 1;
} | CWE-352 | 0 |
protected function __construct() {
parent::__construct();
self::$locale = fusion_get_locale('', LOCALE.LOCALESET.'search.php');
} | CWE-352 | 0 |
public static function recent($vars, $type = 'post') {
$sql = "SELECT * FROM `posts` WHERE `type` = '{$type}' ORDER BY `date` DESC LIMIT {$vars}";
$posts = Db::result($sql);
if(isset($posts['error'])){
$posts['error'] = "No Posts found.";
}else{
$posts = $posts;
}
return $posts;
} | CWE-352 | 0 |
public static function getId($id=''){
if(isset($id)){
$sql = sprintf("SELECT * FROM `menus` WHERE `id` = '%d' ORDER BY `order` ASC", $id);
$menus = Db::result($sql);
$n = Db::$num_rows;
}else{
$menus = '';
}
return $menus;
} | CWE-352 | 0 |
public function archive(){
$login_user = $this->checkLogin();
$item_id = I("item_id/d");
$password = I("password");
$item = D("Item")->where("item_id = '$item_id' ")->find();
if(!$this->checkItemManage($login_user['uid'] , $item['item_id'])){
$this->sendError(10303);
return ;
}
if(! D("User")-> checkLogin($item['username'],$password)){
$this->sendError(10208);
return ;
}
$return = D("Item")->where("item_id = '$item_id' ")->save(array("is_archived"=>1));
if (!$return) {
$this->sendError(10101);
}else{
$this->sendResult($return);
}
} | CWE-352 | 0 |
static function canView() {
return Session::haveRight(self::$rightname, READ);
} | CWE-352 | 0 |
public static function RemoveTransaction($id)
{
$sFilepath = APPROOT.'data/transactions/'.$id;
clearstatcache(true, $sFilepath);
if (!file_exists($sFilepath)) {
$bSuccess = false;
self::Error("RemoveTransaction: Transaction '$id' not found. Pending transactions for this user:\n"
.implode("\n", self::GetPendingTransactions()));
} else {
$bSuccess = @unlink($sFilepath);
}
if (!$bSuccess) {
self::Error('RemoveTransaction: FAILED to remove transaction '.$id);
} else {
self::Info('RemoveTransaction: OK '.$id);
}
return $bSuccess;
} | CWE-352 | 0 |
public function startup(Event $event)
{
$controller = $event->subject();
$request = $controller->request;
$response = $controller->response;
$cookieName = $this->_config['cookieName'];
$cookieData = $request->cookie($cookieName);
if ($cookieData) {
$request->params['_csrfToken'] = $cookieData;
}
if ($request->is('requested')) {
return;
}
if ($request->is('get') && $cookieData === null) {
$this->_setCookie($request, $response);
}
if ($request->is(['patch', 'put', 'post', 'delete'])) {
$this->_validateToken($request);
unset($request->data[$this->_config['field']]);
}
} | CWE-352 | 0 |
public function testPinCommentAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/details');
$form = $client->getCrawler()->filter('form[name=customer_comment_form]')->form();
$client->submit($form, [
'customer_comment_form' => [
'message' => 'Blah foo bar',
]
]);
$this->assertIsRedirect($client, $this->createUrl('/admin/customer/1/details'));
$client->followRedirect();
$node = $client->getCrawler()->filter('div.box#comments_box .direct-chat-text');
self::assertStringContainsString('Blah foo bar', $node->html());
$node = $client->getCrawler()->filter('div.box#comments_box .direct-chat-text a.btn.active');
self::assertEquals(0, $node->count());
$comments = $this->getEntityManager()->getRepository(CustomerComment::class)->findAll();
$id = $comments[0]->getId();
$this->request($client, '/admin/customer/' . $id . '/comment_pin');
$this->assertIsRedirect($client, $this->createUrl('/admin/customer/1/details'));
$client->followRedirect();
$node = $client->getCrawler()->filter('div.box#comments_box .box-body a.btn.active');
self::assertEquals(1, $node->count());
self::assertEquals($this->createUrl('/admin/customer/' . $id . '/comment_pin'), $node->attr('href'));
} | CWE-352 | 0 |
public function delete(){
$login_user = $this->checkLogin();
$uid = $login_user['uid'] ;
$id = I("id/d")? I("id/d") : 0;
$teamItemInfo = D("TeamItem")->where(" id = '$id' ")->find();
$item_id = $teamItemInfo['item_id'] ;
$team_id = $teamItemInfo['team_id'] ;
if(!$this->checkItemManage($uid , $item_id)){
$this->sendError(10303);
return ;
}
$ret = D("TeamItemMember")->where(" item_id = '$item_id' and team_id = '$team_id' ")->delete();
$ret = D("TeamItem")->where(" id = '$id' ")->delete();
if ($ret) {
$this->sendResult($ret);
}else{
$return['error_code'] = 10103 ;
$return['error_message'] = 'request fail' ;
$this->sendResult($return);
}
} | CWE-352 | 0 |
public function deleteUser(){
$login_user = $this->checkLogin();
$this->checkAdmin();
$uid = I("uid/d");
if (D("Item")->where("uid = '$uid' and is_del = 0 ")->find()) {
$this->sendError(10101,"该用户名下还有项目,不允许删除。请先将其项目删除或者重新分配/转让");
return ;
}
$return = D("User")->delete_user($uid);
if (!$return) {
$this->sendError(10101);
}else{
$this->sendResult($return);
}
} | CWE-352 | 0 |
foreach ($indexesOld as $index) {
if (\in_array('name', $index->getColumns()) || \in_array('mail', $index->getColumns())) {
$this->indexesOld[] = $index;
$this->addSql('DROP INDEX ' . $index->getName() . ' ON ' . $users);
}
} | CWE-352 | 0 |
$debug_info .= sprintf("%s%s\r\n", str_pad($header_name . ': ', 20), w3_escape_comment($header_value));
}
} | CWE-352 | 0 |
function append_token_to_url()
{
return '/&token_submit=' . $_SESSION['Token'];
} | CWE-352 | 0 |
public function delete($id) {
$this->auth->checkIfOperationIsAllowed('delete_user');
//Test if user exists
$data['users_item'] = $this->users_model->getUsers($id);
if (empty($data['users_item'])) {
redirect('notfound');
} else {
$this->users_model->deleteUser($id);
}
log_message('error', 'User #' . $id . ' has been deleted by user #' . $this->session->userdata('id'));
$this->session->set_flashdata('msg', lang('users_delete_flash_msg_success'));
redirect('users');
} | CWE-352 | 0 |
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
app('view')->share('title', (string) trans('firefly.currencies'));
app('view')->share('mainTitleIcon', 'fa-usd');
$this->repository = app(CurrencyRepositoryInterface::class);
$this->userRepository = app(UserRepositoryInterface::class);
return $next($request);
}
);
} | CWE-352 | 0 |
function execute( $par ) {
$request = $this->getRequest();
$output = $this->getOutput();
$language = $this->getLanguage();
$output->setPageTitle( $this->msg( "confirmaccounts" )->escaped() );
$output->addModules('ext.scratchConfirmAccount.js');
$output->addModuleStyles('ext.scratchConfirmAccount.css');
$session = $request->getSession();
$this->setHeaders();
$this->checkReadOnly();
$this->showTopLinks();
//check permissions
$user = $this->getUser();
if (!$user->isAllowed('createaccount')) {
throw new PermissionsError('createaccount');
}
if ($request->wasPosted()) {
return $this->handleFormSubmission($request, $output, $session);
} else if (strpos($par, wfMessage('scratch-confirmaccount-blocks')->text()) === 0) {
return $this->blocksPage($par, $request, $output, $session);
} else if (strpos($par, wfMessage('scratch-confirmaccount-requirements-bypasses-url')->text()) === 0) {
$bypassPage = new RequirementsBypassPage($this);
return $bypassPage->render();
} else if ($request->getText('username')) {
return $this->searchByUsername($request->getText('username'), $request, $output);
} else if (isset(statuses[$par])) {
return $this->listRequestsByStatus($par, $output);
} else if (ctype_digit($par)) {
return requestPage($par, 'admin', $this, $request->getSession());
} else if (empty($par)) {
return $this->defaultPage($output);
} else {
$output->showErrorPage('error', 'scratch-confirmaccount-nosuchrequest');
}
} | CWE-352 | 0 |
public static function get_param($key = NULL) {
$info = [
'stype' => self::$search_type,
'stext' => self::$search_text,
'method' => self::$search_method,
'datelimit' => self::$search_date_limit,
'fields' => self::$search_fields,
'sort' => self::$search_sort,
'chars' => self::$search_chars,
'order' => self::$search_order,
'forum_id' => self::$forum_id,
'memory_limit' => self::$memory_limit,
'composevars' => self::$composevars,
'rowstart' => self::$rowstart,
'search_param' => self::$search_param,
];
return $key === NULL ? $info : (isset($info[$key]) ? $info[$key] : NULL);
} | CWE-352 | 0 |
public function disable($id) {
$this->active($id, FALSE);
} | CWE-352 | 0 |
echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />';
} | CWE-352 | 0 |
public function updateInfo(){
$user = $this->checkLogin();
$uid = $user['uid'];
$name = I("name");
D("User")->where(" uid = '$uid' ")->save(array("name"=>$name));
$this->sendResult(array());
} | CWE-352 | 0 |
public function delete(){
$page_id = I("page_id/d")? I("page_id/d") : 0;
$page = D("Page")->where(" page_id = '$page_id' ")->find();
$login_user = $this->checkLogin();
if (!$this->checkItemManage($login_user['uid'] , $page['item_id']) && $login_user['uid'] != $page['author_uid']) {
$this->sendError(10303);
return ;
}
if ($page) {
$ret = D("Page")->softDeletePage($page_id);
//更新项目时间
D("Item")->where(" item_id = '$page[item_id]' ")->save(array("last_update_time"=>time()));
}
if ($ret) {
$this->sendResult(array());
}else{
$this->sendError(10101);
}
} | CWE-352 | 0 |
public static function getParent($parent='', $menuid = ''){
if(isset($menuid)){
$where = " AND `menuid` = '{$menuid}'";
}else{
$where = '';
}
$sql = sprintf("SELECT * FROM `menus` WHERE `parent` = '%s' %s", $parent, $where);
$menu = Db::result($sql);
return $menu;
} | CWE-352 | 0 |
public static function secureCompare($known, $user)
{
if (function_exists('hash_equals')) {
// use hash_equals() if available (PHP >= 5.6)
return hash_equals($known, $user);
}
// compare manually in constant time
$len = mb_strlen($known, '8bit'); // see mbstring.func_overload
if ($len !== mb_strlen($user, '8bit')) {
return false; // length differs
}
$diff = 0;
for ($i = 0; $i < $len; ++$i) {
$diff |= $known[$i] ^ $user[$i];
}
// if all the bytes in $a and $b are identical, $diff should be equal to 0
return $diff === 0;
} | CWE-384 | 1 |
public function resetKey(){
$login_user = $this->checkLogin();
$item_id = I("item_id/d");
$item = D("Item")->where("item_id = '$item_id' ")->find();
if(!$this->checkItemManage($login_user['uid'] , $item['item_id'])){
$this->sendError(10303);
return ;
}
$ret = D("ItemToken")->where("item_id = '$item_id' ")->delete();
if ($ret) {
$this->getKey();
}else{
$this->sendError(10101);
}
} | CWE-352 | 0 |
function load() {
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
$this->_page = w3tc_get_current_page();
/**
* Run plugin action
*/
$action = false;
foreach ($_REQUEST as $key => $value) {
if (strpos($key, 'w3tc_') === 0) {
$action = 'action_' . substr($key, 5);
break;
}
}
$flush = false;
$cdn = false;
$support = false;
$action_handler = w3_instance('W3_AdminActions_ActionHandler');
$action_handler->set_default($this);
$action_handler->set_current_page($this->_page);
if ($action && $action_handler->exists($action)) {
if (strpos($action, 'view') !== false)
if (!wp_verify_nonce(W3_Request::get_string('_wpnonce'), 'w3tc'))
wp_nonce_ays('w3tc');
else
check_admin_referer('w3tc');
try {
$action_handler->execute($action);
} catch (Exception $e) {
w3_admin_redirect_with_custom_messages(array(), array($e->getMessage()));
}
exit();
}
} | CWE-352 | 0 |
public function duplicateTeam(Team $team, Request $request)
{
$newTeam = clone $team;
$newTeam->setName($team->getName() . ' [COPY]');
try {
$this->repository->saveTeam($newTeam);
$this->flashSuccess('action.update.success');
return $this->redirectToRoute('admin_team_edit', ['id' => $newTeam->getId()]);
} catch (\Exception $ex) {
$this->flashUpdateException($ex);
}
return $this->redirectToRoute('admin_team');
} | CWE-352 | 0 |
function csrf_start()
{
if ($GLOBALS['csrf']['auto-session'] && session_status() == PHP_SESSION_NONE) {
session_start();
}
} | CWE-352 | 0 |
function yourls_create_nonce( $action, $user = false ) {
if( false == $user )
$user = defined( 'YOURLS_USER' ) ? YOURLS_USER : '-1';
$tick = yourls_tick();
$nonce = substr( yourls_salt($tick . $action . $user), 0, 10 );
// Allow plugins to alter the nonce
return yourls_apply_filter( 'create_nonce', $nonce, $action, $user );
} | CWE-352 | 0 |
public function deleteCommentAction(CustomerComment $comment)
{
$customerId = $comment->getCustomer()->getId();
try {
$this->repository->deleteComment($comment);
} catch (\Exception $ex) {
$this->flashDeleteException($ex);
}
return $this->redirectToRoute('customer_details', ['id' => $customerId]);
} | CWE-352 | 0 |
public function edit(Request $request, TransactionCurrency $currency)
{
/** @var User $user */
$user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) {
$request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));
Log::channel('audit')->info(sprintf('Tried to edit currency %s but is not owner.', $currency->code));
return redirect(route('currencies.index'));
}
$subTitleIcon = 'fa-pencil';
$subTitle = (string) trans('breadcrumbs.edit_currency', ['name' => $currency->name]);
$currency->symbol = htmlentities($currency->symbol);
// code to handle active-checkboxes
$hasOldInput = null !== $request->old('_token');
$preFilled = [
'enabled' => $hasOldInput ? (bool) $request->old('enabled') : $currency->enabled,
];
$request->session()->flash('preFilled', $preFilled);
Log::channel('audit')->info('Edit currency.', $currency->toArray());
// put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('currencies.edit.fromUpdate')) {
$this->rememberPreviousUri('currencies.edit.uri');
}
$request->session()->forget('currencies.edit.fromUpdate');
return prefixView('currencies.edit', compact('currency', 'subTitle', 'subTitleIcon'));
} | CWE-352 | 0 |
public function active($id, $active) {
$this->auth->checkIfOperationIsAllowed('list_users');
$this->users_model->setActive($id, $active);
$this->session->set_flashdata('msg', lang('users_edit_flash_msg_success'));
redirect('users');
} | CWE-352 | 0 |
static function getTypeName($nb = 0) {
return __('Maintenance');
} | CWE-352 | 0 |
public static function post($vars) {
switch (SMART_URL) {
case true:
# code...
$url = Options::get('siteurl')."/".self::slug($vars)."/{$vars}";
break;
default:
# code...
$url = Options::get('siteurl')."/index.php?post={$vars}";
break;
}
return $url;
} | CWE-352 | 0 |
public function __construct(UserInviteService $inviteService, LoginService $loginService, UserRepo $userRepo)
{
$this->middleware('guest');
$this->middleware('guard:standard');
$this->inviteService = $inviteService;
$this->loginService = $loginService;
$this->userRepo = $userRepo;
} | CWE-352 | 0 |
function OA_runMPE()
{
$objResponse = new xajaxResponse();
$objResponse->addAssign("run-mpe", "innerHTML", "<img src='run-mpe.php' />");
return $objResponse;
} | CWE-352 | 0 |
private function mailPassthru($to, $subject, $body, $header, $params)
{
//Check overloading of mail function to avoid double-encoding
if (ini_get('mbstring.func_overload') & 1) {
$subject = $this->secureHeader($subject);
} else {
$subject = $this->encodeHeader($this->secureHeader($subject));
}
if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
$result = @mail($to, $subject, $body, $header);
} else {
$result = @mail($to, $subject, $body, $header, $params);
}
return $result;
} | CWE-352 | 0 |
public function addAddress($address, $name = '')
{
return $this->addAnAddress('to', $address, $name);
} | CWE-352 | 0 |
public function __construct () {
if (self::existConf()) {
# code...
self::config('config');
self::lang(GX_LANG);
}else{
GxMain::install();
}
} | CWE-352 | 0 |
public function attorn(){
$login_user = $this->checkLogin();
$this->checkAdmin();
$username = I("username");
$item_id = I("item_id/d");
$item = D("Item")->where("item_id = '$item_id' ")->find();
$member = D("User")->where(" username = '%s' ",array($username))->find();
if (!$member) {
$this->sendError(10209);
return ;
}
$data['username'] = $member['username'] ;
$data['uid'] = $member['uid'] ;
$id = D("Item")->where(" item_id = '$item_id' ")->save($data);
$return = D("Item")->where("item_id = '$item_id' ")->find();
if (!$return) {
$this->sendError(10101);
return ;
}
$this->sendResult($return);
} | CWE-352 | 0 |
public function validateRequest(App\Request $request)
{
$request->validateReadAccess();
} | CWE-352 | 0 |
public function __construct($exceptions = false)
{
$this->exceptions = ($exceptions == true);
} | CWE-352 | 0 |
public function batUpdate(){
$cats = I("cats");
$item_id = I("item_id/d");
$login_user = $this->checkLogin();
if (!$this->checkItemEdit($login_user['uid'] , $item_id)) {
$this->sendError(10103);
return ;
}
$ret = '';
$data_array = json_decode(htmlspecialchars_decode($cats) , true) ;
if ($data_array) {
foreach ($data_array as $key => $value) {
if ($value['cat_name']) {
$ret = D("Catalog")->where(" cat_id = '%d' and item_id = '%d' ",array($value['cat_id'],$item_id) )->save(array(
"cat_name" => $value['cat_name'] ,
"parent_cat_id" => $value['parent_cat_id'] ,
"level" => $value['level'] ,
"s_number" => $value['s_number'] ,
));
}
if ($value['page_id'] > 0) {
$ret = D("Page")->where(" page_id = '%d' and item_id = '%d' " ,array($value['page_id'],$item_id) )->save(array(
"cat_id" => $value['parent_cat_id'] ,
"s_number" => $value['s_number'] ,
));
}
}
}
$this->sendResult(array());
} | CWE-352 | 0 |
public static function get_param($key = NULL) {
$info = [
'stype' => htmlentities(self::$search_type),
'stext' => htmlentities(self::$search_text),
'method' => htmlentities(self::$search_method),
'datelimit' => self::$search_date_limit,
'fields' => self::$search_fields,
'sort' => self::$search_sort,
'chars' => htmlentities(self::$search_chars),
'order' => self::$search_order,
'forum_id' => self::$forum_id,
'memory_limit' => self::$memory_limit,
'composevars' => self::$composevars,
'rowstart' => self::$rowstart,
'search_param' => self::$search_param,
];
return $key === NULL ? $info : (isset($info[$key]) ? $info[$key] : NULL);
} | CWE-352 | 0 |
public function duplicateAction(Project $project, Request $request, ProjectDuplicationService $projectDuplicationService)
{
$newProject = $projectDuplicationService->duplicate($project, $project->getName() . ' [COPY]');
return $this->redirectToRoute('project_details', ['id' => $newProject->getId()]);
} | CWE-352 | 0 |
public function addBCC($address, $name = '')
{
return $this->addAnAddress('bcc', $address, $name);
} | CWE-352 | 0 |
click: function(p,o) {
p.on(o.event, o.children, function(e){
if(f.detect.leftMouse(e)) {
if ($(e.target).hasClass('ch-toggle') ||
$(e.target).hasClass('check-label') ||
( $(e.target).hasClass('l-unit-toolbar__col--left')) ) {
var c = f.get.clicks(p,o,$(this));
var ref = $(e.target);
if (ref.parents('.l-unit').hasClass('selected') && $('.l-unit.selected').length == 1) {
ref.parents('.l-unit').find('.ch-toggle').attr('checked', false);
ref.parents('.l-unit').removeClass('selected');
ref.parents('.l-unit').removeClass('selected-current');
$('.toggle-all').removeClass('clicked-on');
return;
}
if (!(f.detect.ctrl(e) && o.enableCtrlClick) && (f.detect.shift(e) && o.enableShiftClick)) {
f.t.deleteSelection(o);
f.t.shiftClick(p,c,o);
}
if (((f.detect.ctrl(e) && o.enableCtrlClick) || (f.detect.touch() && o.enableTouchCtrlDefault) || o.enableDesktopCtrlDefault) && !(f.detect.shift(e) && o.enableShiftClick)) {
f.t.toggleClick(p,c,o);
}
if (!(f.detect.ctrl(e) && o.enableCtrlClick) && !(f.detect.shift(e) && o.enableShiftClick) && o.enableSingleClick && !o.enableDesktopCtrlDefault) {
f.t.singleClick(p,c,o);
}
}
}
o.onFinish(e);
});
}, | CWE-352 | 0 |
$scope.reset = function() {
bootbox.confirm('Are you sure you want to reset the foreign source definition to the default ?', function(ok) {
if (ok) {
RequisitionsService.startTiming();
RequisitionsService.deleteForeignSourceDefinition($scope.foreignSource).then(
function() { // success
growl.success('The foreign source definition for ' + $scope.foreignSource + 'has been reseted.');
$scope.initialize();
},
$scope.errorHandler
);
}
});
}; | CWE-352 | 0 |
wp.updates.requestFilesystemCredentials = function( event ) {
if ( wp.updates.updateDoneSuccessfully === false ) {
/*
* For the plugin install screen, return the focus to the install button
* after exiting the credentials request modal.
*/
if ( 'plugin-install' === pagenow && event ) {
wp.updates.$elToReturnFocusToFromCredentialsModal = $( event.target );
}
wp.updates.updateLock = true;
wp.updates.requestForCredentialsModalOpen();
}
}; | CWE-352 | 0 |
function set_utilization(type, entity_id, name, value) {
var data = {
name: name,
value: value
};
if (type == "node") {
data["node"] = entity_id;
} else if (type == "resource") {
data["resource_id"] = entity_id;
} else return false;
var url = get_cluster_remote_url() + "set_" + type + "_utilization";
$.ajax({
type: 'POST',
url: url,
data: data,
timeout: pcs_timeout,
error: function (xhr, status, error) {
alert(
"Unable to set utilization: "
+ ajax_simple_error(xhr, status, error)
);
},
complete: function() {
Pcs.update();
}
});
} | CWE-384 | 1 |
function genericAjaxPopupDestroy($layer) {
$popup = genericAjaxPopupFetch($layer);
if(null != $popup) {
genericAjaxPopupClose($layer);
try {
$popup.dialog('destroy');
$popup.unbind();
} catch(e) { }
$($('#devblocksPopups').data($layer)).remove(); // remove DOM
$('#devblocksPopups').removeData($layer); // remove from registry
return true;
}
return false;
} | CWE-352 | 0 |
$scope.provision = function() {
$scope.isSaving = true;
growl.info($sanitize('The node ' + $scope.node.nodeLabel + ' is being added to requisition ' + $scope.node.foreignSource + '. Please wait...'));
var successMessage = $sanitize('The node ' + $scope.node.nodeLabel + ' has been added to requisition ' + $scope.node.foreignSource);
RequisitionsService.quickAddNode($scope.node).then(
function() { // success
$scope.reset();
bootbox.dialog({
message: successMessage,
title: 'Success',
buttons: {
main: {
label: 'Ok',
className: 'btn-secondary'
}
}
});
},
$scope.errorHandler
);
}; | CWE-352 | 0 |
plugin: $( this ).data( 'plugin' ),
slug: $( this ).data( 'slug' )
}
};
target.postMessage( JSON.stringify( job ), window.location.origin );
});
} );
$( window ).on( 'message', function( e ) {
var event = e.originalEvent,
message,
loc = document.location,
expectedOrigin = loc.protocol + '//' + loc.hostname;
if ( event.origin !== expectedOrigin ) {
return;
}
message = $.parseJSON( event.data );
if ( typeof message.action === 'undefined' ) {
return;
}
switch (message.action){
case 'decrementUpdateCount' :
wp.updates.decrementCount( message.upgradeType );
break;
case 'updatePlugin' :
tb_remove();
wp.updates.updateQueue.push( message );
wp.updates.queueChecker();
break;
}
} );
$( window ).on( 'beforeunload', wp.updates.beforeunload );
})( jQuery, window.wp, window.pagenow, window.ajaxurl ); | CWE-352 | 0 |
render: function() {
var data = this.model.toJSON();
// Render themes using the html template
this.$el.html( this.html( data ) ).attr({
tabindex: 0,
'aria-describedby' : data.id + '-action ' + data.id + '-name'
});
// Renders active theme styles
this.activeTheme();
if ( this.model.get( 'displayAuthor' ) ) {
this.$el.addClass( 'display-author' );
}
if ( this.model.get( 'installed' ) ) {
this.$el.addClass( 'is-installed' );
}
}, | CWE-352 | 0 |
function remove_cluster(ids) {
var data = {};
$.each(ids, function(_, cluster) {
data[ "clusterid-" + cluster] = true;
});
$.ajax({
type: 'POST',
url: '/manage/removecluster',
data: data,
timeout: pcs_timeout,
success: function () {
$("#dialog_verify_remove_clusters.ui-dialog-content").each(function(key, item) {$(item).dialog("destroy")});
Pcs.update();
},
error: function (xhr, status, error) {
alert("Unable to remove cluster: " + res + " ("+error+")");
$("#dialog_verify_remove_clusters.ui-dialog-content").each(function(key, item) {$(item).dialog("destroy")});
}
});
} | CWE-384 | 1 |
$scope.deleteNode = function(node) {
bootbox.confirm('Are you sure you want to remove the node ' + node.nodeLabel + '?', function(ok) {
if (ok) {
RequisitionsService.startTiming();
RequisitionsService.deleteNode(node).then(
function() { // success
var index = -1;
for(var i = 0; i < $scope.filteredNodes.length; i++) {
if ($scope.filteredNodes[i].foreignId === node.foreignId) {
index = i;
}
}
if (index > -1) {
$scope.filteredNodes.splice(index,1);
}
growl.success('The node ' + node.nodeLabel + ' has been deleted.');
},
$scope.errorHandler
);
}
});
}; | CWE-352 | 0 |
form.append($('<input>', { name: i, value: JSON.stringify(postData[i]) }));
}
$('body').append(form);
form.submit();
} else {
window.location.href = url;
}
}, | CWE-352 | 0 |
wp.updates.showErrorInCredentialsForm = function( message ) {
var $modal = $( '.notification-dialog' );
// Remove any existing error.
$modal.find( '.error' ).remove();
$modal.find( 'h3' ).after( '<div class="error">' + message + '</div>' );
}; | CWE-352 | 0 |
$scope.initialize = function(customHandler) {
var value = $cookies.get('requisitions_page_size');
if (value) {
$scope.pageSize = value;
}
growl.success('Retrieving requisition ' + $scope.foreignSource + '...');
RequisitionsService.getRequisition($scope.foreignSource).then(
function(requisition) { // success
$scope.requisition = requisition;
$scope.filteredNodes = requisition.nodes;
$scope.updateFilteredNodes();
if (customHandler) {
customHandler();
}
},
$scope.errorHandler
);
}; | CWE-352 | 0 |
$scope.refresh = function() {
growl.success('Retrieving node ' + $scope.foreignId + ' from requisition ' + $scope.foreignSource + '...');
RequisitionsService.getNode($scope.foreignSource, $scope.foreignId).then(
function(node) { // success
$scope.node = node;
},
$scope.errorHandler
);
}; | CWE-352 | 0 |
this.goto_url('export', { _source: this.env.source, _gid: this.env.group, _cid: this.contact_list.get_selection().join(',') });
}
break;
case 'upload-photo':
this.upload_contact_photo(props || this.gui_objects.uploadform);
break;
case 'delete-photo':
this.replace_contact_photo('-del-');
break;
// user settings commands
case 'preferences':
case 'identities':
case 'responses':
case 'folders':
this.goto_url('settings/' + command);
break;
case 'undo':
this.http_request('undo', '', this.display_message('', 'loading'));
break;
// unified command call (command name == function name)
default:
var func = command.replace(/-/g, '_');
if (this[func] && typeof this[func] === 'function') {
ret = this[func](props, obj, event);
}
break;
}
if (!aborted && this.triggerEvent('after'+command, props) === false)
ret = false;
this.triggerEvent('actionafter', { props:props, action:command, aborted:aborted });
return ret === false ? false : obj ? false : true;
}; | CWE-352 | 0 |
function genericAjaxPopupFind($sel) {
$devblocksPopups = $('#devblocksPopups');
$data = $devblocksPopups.data();
$element = $($sel).closest('DIV.devblocks-popup');
for($key in $data) {
if($element.attr('id') == $data[$key].attr('id'))
return $data[$key];
}
return null;
} | CWE-352 | 0 |
$scope.removeAllNodes = function(foreignSource) {
bootbox.confirm('Are you sure you want to remove all the nodes from ' + foreignSource + '?', function(ok) {
if (ok) {
RequisitionsService.startTiming();
RequisitionsService.removeAllNodesFromRequisition(foreignSource).then(
function() { // success
growl.success('All the nodes from ' + foreignSource + ' have been removed, and the requisition has been synchronized.');
var req = $scope.requisitionsData.getRequisition(foreignSource);
req.reset();
},
$scope.errorHandler
);
}
});
}; | CWE-352 | 0 |
$scope.add = function() {
bootbox.prompt('Please enter the name for the new requisition', function(foreignSource) {
if (foreignSource) {
// Validate Requisition
if (foreignSource.match(/[/\\?:&*'"]/)) {
bootbox.alert('Cannot add the requisition ' + foreignSource + ' because the following characters are invalid:<br/>:, /, \\, ?, &, *, \', "');
return;
}
var r = $scope.requisitionsData.getRequisition(foreignSource);
if (r) {
bootbox.alert('Cannot add the requisition ' + foreignSource+ ' because there is already a requisition with that name');
return;
}
// Create Requisition
RequisitionsService.addRequisition(foreignSource).then(
function(r) { // success
growl.success('The requisition ' + r.foreignSource + ' has been created.');
},
$scope.errorHandler
);
}
});
}; | CWE-352 | 0 |
function checkExistingNode() {
var node = "";
$('input[name="node-name"]').each(function(i,e) {
node = e.value;
});
$.ajax({
type: 'GET',
url: '/manage/check_pcsd_status',
data: {"nodes": node},
timeout: pcs_timeout,
success: function (data) {
mydata = jQuery.parseJSON(data);
update_existing_cluster_dialog(mydata);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("ERROR: Unable to contact server");
}
});
} | CWE-384 | 1 |
var doSynchronize = function(requisition, rescanExisting) {
RequisitionsService.startTiming();
RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then(
function() { // success
growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics');
requisition.setDeployed(true);
},
errorHandler
);
}; | CWE-352 | 0 |
expand: function( id ) {
var self = this;
// Set the current theme model
this.model = self.collection.get( id );
// Trigger a route update for the current model
themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.id ) );
// Sets this.view to 'detail'
this.setView( 'detail' );
$( 'body' ).addClass( 'modal-open' );
// Set up the theme details view
this.overlay = new themes.view.Details({
model: self.model
});
this.overlay.render();
this.$overlay.html( this.overlay.el );
// Bind to theme:next and theme:previous
// triggered by the arrow keys
//
// Keep track of the current model so we
// can infer an index position
this.listenTo( this.overlay, 'theme:next', function() {
// Renders the next theme on the overlay
self.next( [ self.model.cid ] );
})
.listenTo( this.overlay, 'theme:previous', function() {
// Renders the previous theme on the overlay
self.previous( [ self.model.cid ] );
});
}, | CWE-352 | 0 |
link: function(scope, element, attrs) {
var width = 120;
var height = 39;
var div = $('<div class="terminal">A</div>').css({
position: 'absolute',
left: -1000,
top: -1000,
display: 'block',
padding: 0,
margin: 0,
'font-family': 'monospace'
}).appendTo($('body'));
var charWidth = div.width();
var charHeight = div.height();
div.remove();
// compensate for internal horizontal padding
var cssWidth = width * charWidth + 20;
// Add an extra line for the status bar and divider
var cssHeight = (height * charHeight) + charHeight + 2;
log.debug("desired console size in characters, width: ", width, " height: ", height);
log.debug("console size in pixels, width: ", cssWidth, " height: ", cssHeight);
log.debug("character size in pixels, width: ", charWidth, " height: ", charHeight);
element.css({
width: cssWidth,
height: cssHeight,
'min-width': cssWidth,
'min-height': cssHeight
});
var authHeader = Core.getBasicAuthHeader(userDetails.username, userDetails.password);
gogo.Terminal(element.get(0), width, height, authHeader);
scope.$on("$destroy", function(e) {
document.onkeypress = null;
document.onkeydown = null;
});
} | CWE-352 | 0 |
$scope.initialize = function() {
growl.success('Retrieving definition for requisition ' + $scope.foreignSource + '...');
RequisitionsService.getForeignSourceDefinition($scope.foreignSource).then(
function(foreignSourceDef) { // success
$scope.foreignSourceDef = foreignSourceDef;
// Updating pagination variables for detectors.
$scope.filteredDetectors = $scope.foreignSourceDef.detectors;
$scope.updateFilteredDetectors();
// Updating pagination variables for policies.
$scope.filteredPolicies = $scope.foreignSourceDef.policies;
$scope.updateFilteredPolicies();
},
$scope.errorHandler
);
}; | CWE-352 | 0 |
function updateActionButtons() {
if (0 !== count) {
$('.action-menu').show();
// also update labels:
$('.mass-edit span').text(edit_selected_txt + ' (' + count + ')');
$('.bulk-edit span').text(edit_bulk_selected_txt + ' (' + count + ')');
$('.mass-delete span').text(delete_selected_txt + ' (' + count + ')');
}
if (0 === count) {
$('.action-menu').hide();
}
} | CWE-352 | 0 |
wp.updates.updateSuccess = function( response ) {
var $updateMessage, name, $pluginRow, newText;
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
$pluginRow = $( '[data-plugin="' + response.plugin + '"]' ).first();
$updateMessage = $pluginRow.next().find( '.update-message' );
$pluginRow.addClass( 'updated' ).removeClass( 'update' );
// Update the version number in the row.
newText = $pluginRow.find('.plugin-version-author-uri').html().replace( response.oldVersion, response.newVersion );
$pluginRow.find('.plugin-version-author-uri').html( newText );
// Add updated class to update message parent tr
$pluginRow.next().addClass( 'updated' );
} else if ( 'plugin-install' === pagenow ) {
$updateMessage = $( '.plugin-card-' + response.slug ).find( '.update-now' );
$updateMessage.addClass( 'button-disabled' );
name = $updateMessage.data( 'name' );
$updateMessage.attr( 'aria-label', wp.updates.l10n.updatedLabel.replace( '%s', name ) );
}
$updateMessage.removeClass( 'updating-message' ).addClass( 'updated-message' );
$updateMessage.text( wp.updates.l10n.updated );
wp.a11y.speak( wp.updates.l10n.updatedMsg );
wp.updates.decrementCount( 'plugin' );
wp.updates.updateDoneSuccessfully = true;
/*
* The lock can be released since the update was successful,
* and any other updates can commence.
*/
wp.updates.updateLock = false;
$(document).trigger( 'wp-plugin-update-success', response );
wp.updates.queueChecker();
}; | CWE-352 | 0 |
$scope.save = function() {
var form = this.fsForm;
RequisitionsService.startTiming();
RequisitionsService.saveForeignSourceDefinition($scope.foreignSourceDef).then(
function() { // success
growl.success('The definition for the requisition ' + $scope.foreignSource + ' has been saved.');
form.$dirty = false;
},
$scope.errorHandler
);
}; | CWE-352 | 0 |
function permissions_load_cluster(cluster_name, callback) {
var element_id = "permissions_cluster_" + cluster_name;
$.ajax({
type: "GET",
url: "/permissions_cluster_form/" + cluster_name,
timeout: pcs_timeout,
success: function(data) {
$("#" + element_id).html(data);
$("#" + element_id + " :checkbox").each(function(key, checkbox) {
permissions_fix_dependent_checkboxes(checkbox);
});
permissions_cluster_dirty_flag(cluster_name, false);
if (callback) {
callback();
}
},
error: function(xhr, status, error) {
$("#" + element_id).html(
"Error loading permissions " + ajax_simple_error(xhr, status, error)
);
if (callback) {
callback();
}
}
});
} | CWE-384 | 1 |
slug: $( this ).data( 'slug' )
}
};
target.postMessage( JSON.stringify( job ), window.location.origin );
}); | CWE-352 | 0 |
this.goto_url = function(action, query, lock)
{
this.redirect(this.url(action, query), lock);
}; | CWE-352 | 0 |
wp.updates.requestForCredentialsModalOpen = function() {
var $modal = $( '#request-filesystem-credentials-dialog' );
$( 'body' ).addClass( 'modal-open' );
$modal.show();
$modal.find( 'input:enabled:first' ).focus();
$modal.keydown( wp.updates.keydown );
}; | CWE-352 | 0 |
$scope.add = function() {
bootbox.prompt('Please enter the name for the new requisition', function(foreignSource) {
if (foreignSource) {
// Validate Requisition
if (foreignSource.match(/[/\\?:&*'"]/)) {
bootbox.alert('Cannot add the requisition ' + foreignSource + ' because the following characters are invalid:<br/>:, /, \\, ?, &, *, \', "');
return;
}
var r = $scope.requisitionsData.getRequisition(foreignSource);
if (r) {
bootbox.alert('Cannot add the requisition ' + foreignSource+ ' because there is already a requisition with that name');
return;
}
// Create Requisition
RequisitionsService.addRequisition(foreignSource).then(
function(r) { // success
growl.success('The requisition ' + r.foreignSource + ' has been created.');
},
$scope.errorHandler
);
}
});
}; | CWE-352 | 0 |
url: getPath() + "/shutdown",
data: {"parameter":2},
success: function success(data) {
$("#spinner2").hide();
$("#DialogContent").html(data.text);
$("#DialogFinished").removeClass("hidden");
}
});
}); | CWE-352 | 0 |
requestForm: function (url, params = {}) {
app.openUrlMethodPost(url, params);
} | CWE-352 | 0 |
function updateTotalBudgetedAmount(currencyId) {
// fade info away:
$('span.budgeted_amount[data-currency="' + currencyId + '"]')
.fadeTo(100, 0.1, function () {
//$(this).fadeTo(500, 1.0);
});
// get new amount:
$.get(totalBudgetedUri.replace('REPLACEME',currencyId)).done(function (data) {
// set thing:
$('span.budgeted_amount[data-currency="' + currencyId + '"]')
.html(data.budgeted_formatted)
// fade back:
.fadeTo(300, 1.0);
// set bar:
var pct = parseFloat(data.percentage);
if (pct <= 100) {
console.log('<100 (' + pct + ')');
console.log($('div.budgeted_bar[data-currency="' + currencyId + '"]'));
// red bar to 0
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-danger').width('0%');
// orange to 0:
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-warning').width('0%');
// blue to the rest:
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-info').width(pct + '%');
} else {
var newPct = (100 / pct) * 100;
// red bar to new pct
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-danger').width(newPct + '%');
// orange to the rest:
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-warning').width((100 - newPct) + '%');
// blue to 0:
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-info').width('0%');
}
});
} | CWE-352 | 0 |
$scope.addRequisition = function() {
bootbox.prompt('A requisition is required, please enter the name for a new requisition', function(foreignSource) {
if (foreignSource) {
RequisitionsService.addRequisition(foreignSource).then(
function() { // success
RequisitionsService.synchronizeRequisition(foreignSource, false).then(
function() {
growl.success('The requisition ' + foreignSource + ' has been created and synchronized.');
$scope.foreignSources.push(foreignSource);
},
$scope.errorHandler
);
},
$scope.errorHandler
);
} else {
window.location.href = Util.getBaseHref() + 'admin/opennms/index.jsp'; // TODO Is this the best way ?
}
});
}; | CWE-352 | 0 |
SessionManager.prototype.logIn = function(req, user, cb) {
var self = this;
this._serializeUser(user, req, function(err, obj) {
if (err) {
return cb(err);
}
// TODO: Error if session isn't available here.
if (!req.session) {
req.session = {};
}
if (!req.session[self._key]) {
req.session[self._key] = {};
}
req.session[self._key].user = obj;
cb();
});
} | CWE-384 | 1 |
slug: $( this ).data( 'slug' )
}
};
target.postMessage( JSON.stringify( job ), window.location.origin );
});
} ); | CWE-352 | 0 |
this.changeUserSettingsIndifferent = function(attr,value){
$.get(this.wwwDir+ 'user/setsettingajax/'+attr+'/'+encodeURIComponent(value)+'/(indifferent)/true');
}; | CWE-352 | 0 |
var doSynchronize = function(requisition, rescanExisting) {
RequisitionsService.startTiming();
RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then(
function() { // success
growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics');
requisition.setDeployed(true);
},
errorHandler
);
}; | CWE-352 | 0 |
Comments.init = function(params, callback) {
var app = params.router,
middleware = params.middleware,
controllers = params.controllers;
fs.readFile(path.resolve(__dirname, './public/templates/comments/comments.tpl'), function (err, data) {
Comments.template = data.toString();
});
app.get('/comments/get/:id/:pagination?', middleware.applyCSRF, Comments.getCommentData);
app.post('/comments/reply', Comments.replyToComment);
app.post('/comments/publish', Comments.publishArticle);
app.get('/admin/blog-comments', middleware.admin.buildHeader, renderAdmin);
app.get('/api/admin/blog-comments', renderAdmin);
callback();
}; | CWE-352 | 0 |
goToFullForm(form) {
//As formData contains information about both view and action removed action and directed to view
form.find('input[name="action"]').remove();
form.append('<input type="hidden" name="view" value="Edit" />');
$.each(form.find('[data-validation-engine]'), function (key, data) {
$(data).removeAttr('data-validation-engine');
});
form.addClass('not_validation');
form.submit();
}, | CWE-352 | 0 |
changePassword: function(newPassword) {
var d = $q.defer(),
loginCookie = readLoginCookie();
$http({
method: 'POST',
url: '/SOGo/so/changePassword',
data: {
userName: loginCookie[0],
password: loginCookie[1],
newPassword: newPassword }
}).then(d.resolve, function(response) {
var error,
data = response.data,
perr = data.LDAPPasswordPolicyError;
if (!perr) {
perr = passwordPolicyConfig.PolicyPasswordSystemUnknown;
error = _("Unhandled error response");
}
else if (perr == passwordPolicyConfig.PolicyNoError) {
error = l("Password change failed");
} else if (perr == passwordPolicyConfig.PolicyPasswordModNotAllowed) {
error = l("Password change failed - Permission denied");
} else if (perr == passwordPolicyConfig.PolicyInsufficientPasswordQuality) {
error = l("Password change failed - Insufficient password quality");
} else if (perr == passwordPolicyConfig.PolicyPasswordTooShort) {
error = l("Password change failed - Password is too short");
} else if (perr == passwordPolicyConfig.PolicyPasswordTooYoung) {
error = l("Password change failed - Password is too young");
} else if (perr == passwordPolicyConfig.PolicyPasswordInHistory) {
error = l("Password change failed - Password is in history");
} else {
error = l("Unhandled policy error: %{0}").formatted(perr);
perr = passwordPolicyConfig.PolicyPasswordUnknown;
}
d.reject(error);
});
return d.promise;
} | CWE-352 | 0 |
data: {config_calibre_dir: $("#config_calibre_dir").val()},
success: function success(data) {
if ( data.change ) {
if ( data.valid ) {
confirmDialog(
"db_submit",
"GeneralChangeModal",
0,
changeDbSettings
);
}
else {
$("#InvalidDialog").modal('show');
}
} else {
changeDbSettings();
}
}
});
}); | CWE-352 | 0 |
wp.updates.requestForCredentialsModalCancel = function() {
// no updateLock and no updateQueue means we already have cleared things up
var data, $message;
if( wp.updates.updateLock === false && wp.updates.updateQueue.length === 0 ){
return;
}
data = wp.updates.updateQueue[0].data;
// remove the lock, and clear the queue
wp.updates.updateLock = false;
wp.updates.updateQueue = [];
wp.updates.requestForCredentialsModalClose();
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
$message = $( '[data-plugin="' + data.plugin + '"]' ).next().find( '.update-message' );
} else if ( 'plugin-install' === pagenow ) {
$message = $( '.plugin-card-' + data.slug ).find( '.update-now' );
}
$message.removeClass( 'updating-message' );
$message.html( $message.data( 'originaltext' ) );
wp.a11y.speak( wp.updates.l10n.updateCancel );
}; | CWE-352 | 0 |
function update() {
if (sending == 0) {
sending = 1;
sled.className = 'on';
var r = new XMLHttpRequest();
var send = "";
while (keybuf.length > 0) {
send += keybuf.pop();
}
var query = query1 + send;
if (force) {
query = query + "&f=1";
force = 0;
}
r.open("POST", "hawtio-karaf-terminal/term", true);
r.setRequestHeader('Authorization', authHeader);
r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
r.onreadystatechange = function () {
if (r.readyState == 4) {
if (r.status == 200) {
window.clearTimeout(error_timeout);
if (r.responseText.length > 0) {
dterm.innerHTML = r.responseText;
rmax = 100;
} else {
rmax *= 2;
if (rmax > 2000)
rmax = 2000;
}
sending=0;
sled.className = 'off';
timeout = window.setTimeout(update, rmax);
} else {
debug("Connection error status:" + r.status);
}
}
}
error_timeout = window.setTimeout(error, 5000);
r.send(query);
}
} | CWE-352 | 0 |
wp.updates.requestForCredentialsModalClose = function() {
$( '#request-filesystem-credentials-dialog' ).hide();
$( 'body' ).removeClass( 'modal-open' );
wp.updates.$elToReturnFocusToFromCredentialsModal.focus();
}; | CWE-352 | 0 |
error: function(xhr, status, error) {
if ((status == "timeout") || ($.trim(error) == "timeout")) {
/*
We are not interested in timeout because:
- it can take minutes to stop a node (resources running on it have
to be stopped/moved and we do not need to wait for that)
- if pcs is not able to stop a node it returns an (forceable) error
immediatelly
*/
return;
}
var message = "Unable to stop node '" + node + " " + ajax_simple_error(
xhr, status, error
);
if (message.indexOf('--force') == -1) {
alert(message);
}
else {
message = message.replace(', use --force to override', '');
if (confirm(message + "\n\nDo you want to force the operation?")) {
node_stop(node, true);
}
}
} | CWE-384 | 1 |
gogo.Terminal = function(div, width, height, authHeader) {
return new this.Terminal_ctor(div, width, height, authHeader);
} | CWE-352 | 0 |
function setup_node_links() {
Ember.debug("Setup node links");
$("#node_start").click(function() {
node_link_action(
"#node_start", get_cluster_remote_url() +"cluster_start", "start"
);
});
$("#node_stop").click(function() {
var node = $.trim($("#node_info_header_title_name").text());
fade_in_out("#node_stop");
node_stop(node, false);
});
$("#node_restart").click(function() {
node_link_action(
"#node_restart", get_cluster_remote_url() + "node_restart", "restart"
);
});
$("#node_standby").click(function() {
node_link_action(
"#node_standby", get_cluster_remote_url() + "node_standby", "standby"
);
});
$("#node_unstandby").click(function() {
node_link_action(
"#node_unstandby",
get_cluster_remote_url() + "node_unstandby",
"unstandby"
);
});
} | CWE-384 | 1 |
wp.updates.updatePlugin = function( plugin, slug ) {
var $message, name,
$card = $( '.plugin-card-' + slug );
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
$message = $( '[data-plugin="' + plugin + '"]' ).next().find( '.update-message' );
} else if ( 'plugin-install' === pagenow ) {
$message = $card.find( '.update-now' );
name = $message.data( 'name' );
$message.attr( 'aria-label', wp.updates.l10n.updatingLabel.replace( '%s', name ) );
// Remove previous error messages, if any.
$card.removeClass( 'plugin-card-update-failed' ).find( '.notice.notice-error' ).remove();
}
$message.addClass( 'updating-message' );
if ( $message.html() !== wp.updates.l10n.updating ){
$message.data( 'originaltext', $message.html() );
}
$message.text( wp.updates.l10n.updating );
wp.a11y.speak( wp.updates.l10n.updatingMsg );
if ( wp.updates.updateLock ) {
wp.updates.updateQueue.push( {
type: 'update-plugin',
data: {
plugin: plugin,
slug: slug
}
} );
return;
}
wp.updates.updateLock = true;
var data = {
_ajax_nonce: wp.updates.ajaxNonce,
plugin: plugin,
slug: slug,
username: wp.updates.filesystemCredentials.ftp.username,
password: wp.updates.filesystemCredentials.ftp.password,
hostname: wp.updates.filesystemCredentials.ftp.hostname,
connection_type: wp.updates.filesystemCredentials.ftp.connectionType,
public_key: wp.updates.filesystemCredentials.ssh.publicKey,
private_key: wp.updates.filesystemCredentials.ssh.privateKey
};
wp.ajax.post( 'update-plugin', data )
.done( wp.updates.updateSuccess )
.fail( wp.updates.updateError );
}; | CWE-352 | 0 |
singleClick: function(p,c,o) {
var s = f.get.siblings(p,o);
f.h.off(s, o);
f.h.on(c.current.v, o);
f.set.clicks(c.current.v, null, null, p, o);
}, | CWE-352 | 0 |
function load_agent_form(resource_id, stonith) {
var url;
var form;
if (stonith) {
form = $("#stonith_agent_form");
url = '/managec/' + Pcs.cluster_name + '/fence_device_form';
} else {
form = $("#resource_agent_form");
url = '/managec/' + Pcs.cluster_name + '/resource_form?version=2';
}
form.empty();
var resource_obj = Pcs.resourcesContainer.get_resource_by_id(resource_id);
if (!resource_obj || !resource_obj.get('is_primitive'))
return;
var data = {resource: resource_id};
$.ajax({
type: 'GET',
url: url,
data: data,
timeout: pcs_timeout,
success: function (data) {
Ember.run.next(function(){form.html(data);});
}
});
} | CWE-384 | 1 |
$scope.refresh = function() {
growl.success('Retrieving node ' + $scope.foreignId + ' from requisition ' + $scope.foreignSource + '...');
RequisitionsService.getNode($scope.foreignSource, $scope.foreignId).then(
function(node) { // success
$scope.node = node;
},
$scope.errorHandler
);
}; | CWE-352 | 0 |
Subsets and Splits