PluginProbe
Social Share Buttons / 1.19
Social Share Buttons v1.19
trunk 0.9 1.0 1.1 1.1.1 1.1.2 1.10 1.11 1.12 1.15 1.16 1.17 1.18 1.19 1.2 1.20 1.3 1.30 1.4 1.5 1.6 1.7 1.8 1.9
← All changes | classes/class-collections.php +15 -29 trunk1.19 View file →
@@ -285,9 +285,8 @@
285 285
286 286 $collection_id = intval($post_form["collection_id"]);
287 287
288 288 $admin = MB()->getClass('admin');
289 - $collection = new collection();
290 289
291 290
292 291 if (! Install::isPro() && $collection_id == 0)
293 292 {
@@ -296,9 +295,9 @@
296 295 {
297 296 $result = array(
298 297 "error" => true,
299 298 );
300 - $collection->endAjaxRequest($result);
299 + $admin->endAjaxRequest($result);
301 300 }
302 301 }
303 302
304 303
@@ -314,8 +313,9 @@
314 313 "new_nonce" => 0,
315 314 "title" => __("Saved!","mbsocial"),
316 315 );
317 316
317 + $collection = new collection();
318 318 $collection->set($collection_id);
319 319
320 320 // this can be a new id (!)
321 321 $collection_id = $collection->save($post_form);
@@ -326,9 +326,9 @@
326 326 // $result["data"]["reload"] = apply_filters("collections_ajax_force_reload",$force_reload);
327 327
328 328 // $result["title"] = $result_title["success"];
329 329
330 - $collection->endAjaxRequest($result);
330 + $admin->endAjaxRequest($result);
331 331 }
332 332
333 333 static function ajax_remove_collection()
334 334 {
@@ -334,11 +334,9 @@
334 334 {
335 335 $admin = MB()->getClass('admin');
336 336
337 337 $collection_id = intval($_POST['param']);
338 - $collection = new collection();
339 338
340 -
341 339 $url = admin_url('?page=maxbuttons-social');
342 340
343 341 $result = array(
344 342 'error' => false,
@@ -352,14 +350,15 @@
352 350 $where_format = array("%d");
353 351 $wpdb->delete($table, $where, $where_format);
354 352
355 353
356 - $collection->endAjaxRequest($result);
354 + $admin->endAjaxRequest($result);
357 355
358 356 }
359 357
360 358 static function ajax_action_front()
361 359 {
360 +
362 361 // only for trivial front page actions!
363 362 self::ajax_action(array("ajax_nopriv" => true));
364 363 }
365 364
@@ -368,8 +367,9 @@
368 367 ob_start();
369 368 $defaults = array("ajax_nopriv" => false);
370 369 $args = wp_parse_args($args, $defaults);
371 370
371 +
372 372 $admin = MB()->getClass('admin');
373 373
374 374 $nonce = isset($_POST["nonce"]) ? $_POST["nonce"] : false;
375 375 $block_name = sanitize_text_field($_POST["block_name"]);
@@ -376,31 +376,14 @@
376 376 $block_action = sanitize_text_field($_POST["block_action"]);
377 377 $block_data = (isset($_POST["block_data"])) ? $_POST["block_data"] : '';
378 378 $action = sanitize_text_field($_POST["action"]);
379 379
380 - // Weirdly only one, but security, lets checks this without changing other code too much
381 - $possible_actions =['mbsocial_get_count'];
382 -
383 380 $collection_id = intval($_POST["collection_id"]);
384 - $collection = new collection($collection_id);
381 + // $collection_type = sanitize_text_field($_POST["collection_type"]);
385 382
386 - if (false === in_array($action, $possible_actions))
383 + if(! $args["ajax_nopriv"])
387 384 {
388 - $result["error"] = true;
389 - $result["body"] = __("Bad Action","maxbuttons");
390 - $result["result"] = false;
391 - $result["title"] = __("Security error","maxbuttons");
392 - $result["data"] = array("id" => $collection_id);
393 -
394 - $collection->endAjaxRequest($result);
395 - }
396 -
397 -
398 - // $collection_type = sanitize_text_field($_POST["collection_type"]);
399 -
400 - //if(! $args["ajax_nopriv"])
401 - //{
402 - if (! wp_verify_nonce($nonce, "maxsocial_ajax_action-" . $collection_id))
385 + if (! wp_verify_nonce($nonce, $action . "-" . $collection_id))
403 386 {
404 387 $result["error"] = true;
405 388 $result["body"] = __("Nonce not verified","maxbuttons");
406 389 $result["result"] = false;
@@ -406,12 +389,12 @@
406 389 $result["result"] = false;
407 390 $result["title"] = __("Security error","maxbuttons");
408 391 $result["data"] = array("id" => $collection_id);
409 392
410 - $collection->endAjaxRequest($result);
393 + $admin->endAjaxRequest($result);
411 394
412 395 }
413 - //}
396 + }
414 397
415 398 $result = array(
416 399 "error" => false,
417 400 "body" => '',
@@ -419,13 +402,16 @@
419 402 "data" => array(),
420 403 "new_nonce" => 0,
421 404 );
422 405
406 + $collection = new collection($collection_id);
407 +
423 408 $result = $collection->doBlockAjax($result, $block_name, $block_action, $block_data);
424 409
425 410 //ob_end_clean(); // prevent PHP errors from breaking JSON response.
426 411
427 - $collection->endAjaxRequest($result);
412 + $admin->endAjaxRequest($result);
413 + $results = $collection->get_meta($name, 'collection_name');
428 414 }
429 415
430 416
431 417 public static function ajax_refreshblock()