Skip to content

Commit

Permalink
Merge pull request #4 from mambax7/master
Browse files Browse the repository at this point in the history
2.2 Beta 3
  • Loading branch information
mambax7 authored Oct 2, 2016
2 parents d7f27c4 + b8ab634 commit ab1d8dd
Show file tree
Hide file tree
Showing 145 changed files with 14,921 additions and 12,498 deletions.
31 changes: 31 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
engines:
eslint:
enabled: true
csslint:
enabled: true
duplication:
enabled: true
config:
languages:
- javascript
- php
fixme:
enabled: true
phpmd:
enabled: true
config:
file_extensions:
- php
- inc
phpcodesniffer:
enabled: true
config:
file_extensions: "php,inc,lib"
standard: "PSR1,PSR2"
ratings:
paths:
- "**.inc"
- "**.js"
- "**.lib"
- "**.php"
exclude_paths: []
6 changes: 3 additions & 3 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
} else {
include dirname(dirname(__DIR__)) . '/mainfile.php';
}
include(XOOPS_ROOT_PATH . '/header.php');
include XOOPS_ROOT_PATH . '/header.php';

$xoopsTpl->assign('xoops_showrblock', 1); // 1 = Avec blocs de droite - 0 = Sans blocs de droite
$xoopsTpl->assign('xoops_showlblock', 1); // 1 = Avec blocs de gauche - 0 = Sans blocs de gauche
$xoopsTpl->assign('xoops_pagetitle', _MN_ADSLIGHT_ERROR404);
$xoTheme->addMeta('meta', 'robots', 'noindex, nofollow');
$GLOBALS['xoTheme']->addMeta('meta', 'robots', 'noindex, nofollow');

echo _MN_ADSLIGHT_ERROR404_TEXT;

include(XOOPS_ROOT_PATH . "/footer.php");
include XOOPS_ROOT_PATH . '/footer.php';
339 changes: 0 additions & 339 deletions LICENSE

This file was deleted.

20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
#AdsLight
![alt XOOPS CMS](http://xoops.org/images/logoXoops4GithubRepository.png)
## Adslight module for [XOOPS CMS 2.5.8+](https://xoops.org)
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/mambax7/adslight.svg?style=flat)](https://scrutinizer-ci.com/g/mambax7/adslight/?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/2d27c0023ee54f0b9ba2b5d17a68b2a5)](https://www.codacy.com/app/mambax7/adslight)
[![Code Climate](https://img.shields.io/codeclimate/github/mambax7/adslight.svg?style=flat)](https://codeclimate.com/github/mambax7/adslight)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/58d7b3bf-d7cf-45cb-80fd-6acc46451ef7/mini.png)](https://insight.sensiolabs.com/projects/58d7b3bf-d7cf-45cb-80fd-6acc46451ef7)
[![Latest Pre-Resease](https://img.shields.io/github/tag/XoopsModules25x/adslight.svg?style=flat)](https://github.com/XoopsModules25x/adslight/tags/)
[![Latest Version](https://img.shields.io/github/release/XoopsModules25x/adslight.svg?style=flat)](https://github.com/XoopsModules25x/adslight/releases/)

Adslight is a classifieds module that allow users of XOOPS website to advertise items for sale, exchange or barter.
Adslight module for [XOOPS CMS](http://xoops.org) is a classifieds module that allow users of XOOPS website to advertise items for sale, exchange or barter.

[![Tutorial Available](http://xoops.org/images/tutorial-available-blue.svg)](https://www.gitbook.com/book/xoops/adslight-tutorial/) Tutorial: see [GitBook](https://www.gitbook.com/book/xoops/adslight-tutorial/).
To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/adslight-tutorial)

[![Translations on Transifex](http://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops)

Please visit us on [http://xoops.org](http://xoops.org)

The upcoming "next generation" version of XOOPS CMS is being crafted on GitHub at: https://github.com/XOOPS
513 changes: 246 additions & 267 deletions add.php

Large diffs are not rendered by default.

86 changes: 43 additions & 43 deletions add_photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
Licence Type : GPL
-------------------------------------------------------------------------
*/
use Xmf\Request;

$moduleDirName = basename( dirname( __DIR__ ) ) ;
$main_lang = '_' . strtoupper( $moduleDirName ) ;
$moduleDirName = basename(dirname(__DIR__));
$main_lang = '_' . strtoupper($moduleDirName);

/**
* Xoops header ...
*/
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoopsOption['template_main'] = "adslight_index.tpl";
$GLOBALS['xoopsOption']['template_main'] = 'adslight_index.tpl';
include_once XOOPS_ROOT_PATH . '/header.php';

/**
Expand All @@ -38,62 +39,61 @@
/**
* Factory of pictures created
*/
$album_factory = new Xoopsjlm_picturesHandler($xoopsDB);
$album_factory = new JlmPicturesHandler($xoopsDB);

/**
* Getting the title
*/
$title = $_POST['caption'];
$lid = $_POST['lid'];
$title = Request::getString('caption', '', 'POST');
$lid = Request::getInt('lid', 0, 'POST');
/**
* Getting parameters defined in admin side
*/

$path_upload = $xoopsModuleConfig["adslight_path_upload"];
$pictwidth = $xoopsModuleConfig["adslight_resized_width"];
$pictheight = $xoopsModuleConfig["adslight_resized_height"];
$thumbwidth = $xoopsModuleConfig["adslight_thumb_width"];
$thumbheight = $xoopsModuleConfig["adslight_thumb_height"];
$maxfilebytes = $xoopsModuleConfig["adslight_maxfilesize"];
$maxfileheight = $xoopsModuleConfig["adslight_max_original_height"];
$maxfilewidth = $xoopsModuleConfig["adslight_max_original_width"];
$path_upload = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'];
$pictwidth = $GLOBALS['xoopsModuleConfig']['adslight_resized_width'];
$pictheight = $GLOBALS['xoopsModuleConfig']['adslight_resized_height'];
$thumbwidth = $GLOBALS['xoopsModuleConfig']['adslight_thumb_width'];
$thumbheight = $GLOBALS['xoopsModuleConfig']['adslight_thumb_height'];
$maxfilebytes = $GLOBALS['xoopsModuleConfig']['adslight_maxfilesize'];
$maxfileheight = $GLOBALS['xoopsModuleConfig']['adslight_max_orig_height'];
$maxfilewidth = $GLOBALS['xoopsModuleConfig']['adslight_max_orig_width'];

/**
* If we are receiving a file
*/
if ($_POST['xoops_upload_file'][0]=='sel_photo') {
if ('sel_photo' === Request::getArray('xoops_upload_file', '', 'POST')[0]) {

/**
* Check if using Xoops or XoopsCube (by jlm69)
* Right now Xoops does not have a directory called preload, Xoops Cube does.
* If this finds a diectory called preload in the Xoops Root folder $xCube=true.
* This could change if Xoops adds a Directory called preload
*/
/**
* Check if using Xoops or XoopsCube (by jlm69)
* Right now Xoops does not have a directory called preload, Xoops Cube does.
* If this finds a diectory called preload in the Xoops Root folder $xCube=true.
* This could change if Xoops adds a Directory called preload
*/

$xCube=false;
if (preg_match("/^XOOPS Cube/",XOOPS_VERSION)) { // XOOPS Cube 2.1x
$xCube=true;
}
if ($xCube) {
if ( ! $xoopsGTicket->check( true , 'token' ) ) {
redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors());
$xCube = false;
if (preg_match('/^XOOPS Cube/', XOOPS_VERSION)) { // XOOPS Cube 2.1x
$xCube = true;
}
} else {
if (!($GLOBALS['xoopsSecurity']->check())) {
redirect_header($_SERVER['HTTP_REFERER'], 3, constant("_ADSLIGHT_TOKENEXPIRED"));
}
}
/**
* Try to upload picture resize it insert in database and then redirect to index
*/
if ($album_factory->receivePicture($title,$path_upload, $thumbwidth, $thumbheight, $pictwidth, $pictheight, $maxfilebytes,$maxfilewidth,$maxfileheight)) {
header("Location: ".XOOPS_URL."/modules/adslight/view_photos.php?lid=$lid&uid=".$xoopsUser->getVar('uid'));

$xoopsDB->queryF("UPDATE ".$xoopsDB->prefix("adslight_listing")." SET photo=photo+1 WHERE lid = ".mysql_real_escape_string($lid)."");
if ($xCube) {
if (!$xoopsGTicket->check(true, 'token')) {
redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
}
} else {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($_SERVER['HTTP_REFERER'], 3, constant('_ADSLIGHT_TOKENEXPIRED'));
}
}
/**
* Try to upload picture resize it insert in database and then redirect to index
*/
if ($album_factory->receivePicture($title, $path_upload, $thumbwidth, $thumbheight, $pictwidth, $pictheight, $maxfilebytes, $maxfilewidth, $maxfileheight)) {
header('Location: ' . XOOPS_URL . "/modules/adslight/view_photos.php?lid=$lid&uid=" . $GLOBALS['xoopsUser']->getVar('uid'));

} else {
redirect_header(XOOPS_URL."/modules/adslight/view_photos.php?uid=".$xoopsUser->getVar('uid'),15,constant("_ADSLIGHT_NOCACHACA"));
}
$xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('adslight_listing') . ' SET photo=photo+1 WHERE lid = ' . $xoopsDB->escape($lid));
} else {
redirect_header(XOOPS_URL . '/modules/adslight/view_photos.php?uid=' . $GLOBALS['xoopsUser']->getVar('uid'), 15, constant('_ADSLIGHT_NOCACHACA'));
}
}

/**
Expand Down
Loading

0 comments on commit ab1d8dd

Please sign in to comment.