These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | ------------------------------------------------------------------------- |
||
4 | ADSLIGHT 2 : Module for Xoops |
||
5 | |||
6 | Redesigned and ameliorate By Luc Bizet user at www.frxoops.org |
||
7 | Started with the Classifieds module and made MANY changes |
||
8 | Website : http://www.luc-bizet.fr |
||
9 | Contact : [email protected] |
||
10 | ------------------------------------------------------------------------- |
||
11 | Original credits below Version History |
||
12 | ########################################################################## |
||
13 | # Classified Module for Xoops # |
||
14 | # By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com # |
||
15 | # Started with the MyAds module and made MANY changes # |
||
16 | ########################################################################## |
||
17 | Original Author: Pascal Le Boustouller |
||
18 | Author Website : [email protected] |
||
19 | Licence Type : GPL |
||
20 | ------------------------------------------------------------------------- |
||
21 | */ |
||
22 | |||
23 | $moduleDirName = basename( dirname( __DIR__ ) ) ; |
||
24 | $main_lang = '_' . strtoupper( $moduleDirName ) ; |
||
25 | |||
26 | /** |
||
27 | * Xoops Header |
||
28 | */ |
||
29 | include dirname(dirname(__DIR__)) . '/mainfile.php'; |
||
30 | include_once XOOPS_ROOT_PATH . '/header.php'; |
||
31 | include_once XOOPS_ROOT_PATH . '/class/criteria.php'; |
||
32 | |||
33 | /** |
||
34 | * Module classes |
||
35 | */ |
||
36 | |||
37 | include __DIR__ . '/class/pictures.php'; |
||
38 | |||
39 | /** |
||
40 | * Check if using XoopsCube (by jlm69) |
||
41 | * Needed because of a difference in the way Xoops and XoopsCube handle tokens |
||
42 | */ |
||
43 | |||
44 | $xCube=false; |
||
45 | if (preg_match("/^XOOPS Cube/",XOOPS_VERSION)) { // XOOPS Cube 2.1x |
||
46 | $xCube=true; |
||
47 | } |
||
48 | /** |
||
49 | * Verify Ticket for Xoops Cube (by jlm69) |
||
50 | * If your site is XoopsCube it uses $xoopsGTicket for the token. |
||
51 | |||
52 | */ |
||
53 | |||
54 | View Code Duplication | if ($xCube) { |
|
55 | |||
56 | if ( ! $xoopsGTicket->check( true , 'token' ) ) { |
||
57 | redirect_header($_SERVER['HTTP_REFERER'],3,$xoopsGTicket->getErrors()); |
||
58 | } |
||
59 | } else { |
||
60 | /** |
||
61 | * Verify TOKEN for Xoops |
||
62 | * If your site is Xoops it uses xoopsSecurity for the token. |
||
63 | */ |
||
64 | if (!($GLOBALS['xoopsSecurity']->check())) { |
||
65 | redirect_header($_SERVER['HTTP_REFERER'], 3, constant("_ADSLIGHT_TOKENEXPIRED")); |
||
66 | } |
||
67 | |||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Receiving info from get parameters |
||
72 | */ |
||
73 | $cod_img = $_POST['cod_img']; |
||
74 | |||
75 | /** |
||
76 | * Creating the factory and the criteria to delete the picture |
||
77 | * The user must be the owner |
||
78 | */ |
||
79 | $album_factory = new Xoopsjlm_picturesHandler($xoopsDB); |
||
80 | $criteria_img = new Criteria ('cod_img',$cod_img); |
||
81 | $uid = $xoopsUser->getVar('uid'); |
||
82 | $criteria_uid = new Criteria ('uid_owner',$uid); |
||
83 | //$criteria_lid = new Criteria ('lid',$lid); |
||
0 ignored issues
–
show
|
|||
84 | $criteria = new CriteriaCompo ($criteria_img); |
||
85 | $criteria->add($criteria_uid); |
||
86 | |||
87 | $objects_array = $album_factory->getObjects($criteria); |
||
88 | $image_name = $objects_array[0]->getVar('url'); |
||
89 | /** |
||
90 | * Try to delete |
||
91 | */ |
||
92 | if ($album_factory->deleteAll($criteria)) { |
||
93 | |||
94 | $path_upload = $xoopsModuleConfig["adslight_path_upload"]; |
||
95 | |||
96 | unlink("$path_upload/$image_name"); |
||
97 | |||
98 | unlink("$path_upload/thumbs/thumb_$image_name"); |
||
99 | |||
100 | unlink("$path_upload/midsize/resized_$image_name"); |
||
101 | |||
102 | $lid = $_POST['lid']; |
||
103 | $xoopsDB->queryF("UPDATE ".$xoopsDB->prefix("adslight_listing")." SET photo=photo-1 WHERE lid='$lid'"); |
||
104 | |||
105 | redirect_header("view_photos.php?lid=".$lid."&uid=".$uid."", 13, constant("_ADSLIGHT_DELETED")); |
||
106 | View Code Duplication | } else { |
|
107 | redirect_header("view_photos.php?lid=".$lid."&uid=".$uid."", 13, constant("_ADSLIGHT_NOCACHACA")); |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * Close page |
||
112 | */ |
||
113 | include_once XOOPS_ROOT_PATH . '/footer.php'; |
||
114 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.