Skip to content

Commit

Permalink
Merge pull request #3 from mambax7/master
Browse files Browse the repository at this point in the history
RC-1 updates
  • Loading branch information
mambax7 committed May 26, 2015
2 parents 749798c + a38a4c4 commit 2e753eb
Show file tree
Hide file tree
Showing 57 changed files with 479 additions and 371 deletions.
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# no backup files, editor temp
*~
\#*
*.bak
.idea/
50 changes: 50 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
checks:
php:
code_rating: true
variable_existence: true
useless_calls: true
use_statement_alias_conflict: true
unused_variables: true
unused_properties: true
unused_parameters: true
unused_methods: true
unreachable_code: true
sql_injection_vulnerabilities: true
security_vulnerabilities: true
precedence_mistakes: true
precedence_in_conditions: true
parameter_non_unique: true
no_property_on_interface: true
no_non_implemented_abstract_methods: true
deprecated_code_usage: true
closure_use_not_conflicting: true
closure_use_modifiable: true
avoid_useless_overridden_methods: true
avoid_conflicting_incrementers: true
assignment_of_null_return: true
verify_property_names: true
verify_argument_usable_as_reference: true
verify_access_scope_valid: true
use_self_instead_of_fqcn: true
too_many_arguments: true
single_namespace_per_use: true
return_doc_comment_if_not_inferrable: true
return_doc_comments: true
require_scope_for_methods: true
require_scope_for_properties: true
require_php_tag_first: true
require_braces_around_control_structures: true
psr2_control_structure_declaration: true
psr2_switch_declaration: true
psr2_class_declaration: true
no_eval: true
no_else_if_statements: true
avoid_corrupting_byteorder_marks: true
argument_type_checks: true
php5_style_constructor: true
parameter_doc_comments: true
no_duplicate_arguments: true
missing_arguments: true
instanceof_class_exists: true
foreach_traversable: true
no_unnecessary_function_call_in_for_loop: true
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: php
script:
- phpunit
php:
- 5.3
- 5.4
- 5.5
- 5.6
4 changes: 2 additions & 2 deletions publisher/admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

// Uploading the image, if any
// Retreive the filename to be uploaded
if (($image_file = XoopsRequest::getArray('image_file', '', 'FILES')['name'])) {
if ($image_file = XoopsRequest::getArray('image_file', '', 'FILES')['name']) {
// $filename = XoopsRequest::getArray('xoops_upload_file', array(), 'POST')[0];
if ($filename = XoopsRequest::getArray('xoops_upload_file', array(), 'POST')[0]) {
// TODO : implement publisher mimetype management
Expand Down Expand Up @@ -139,7 +139,7 @@

//Added by fx2024
$parentCat = $categoryObj->categoryid();
$sizeof = sizeof(XoopsRequest::getString('scname', '', 'POST'));
$sizeof = count(XoopsRequest::getString('scname', '', 'POST'));
for ($i = 0; $i < $sizeof; ++$i) {
if (XoopsRequest::getArray('scname', array(), 'POST')[$i] != '') {
$categoryObj = $publisher->getHandler('category')->create();
Expand Down
4 changes: 2 additions & 2 deletions publisher/admin/clone.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public static function createLogo($dirname)
unset($func);
}

if (!file_exists($imageBase = $GLOBALS['xoops']->path("/modules/" . $dirname . "/assets/images/module_logo.png")) || !file_exists($font = $GLOBALS['xoops']->path("/modules/" . $dirname . "/assets/images/VeraBd.ttf"))) {
if (!file_exists($imageBase = $GLOBALS['xoops']->path("modules/" . $dirname . "/assets/images/module_logo.png")) || !file_exists($font = $GLOBALS['xoops']->path("modules/" . $dirname . "/assets/images/VeraBd.ttf"))) {
return false;
}

Expand All @@ -175,7 +175,7 @@ public static function createLogo($dirname)
$white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127);
imagefill($imageModule, 0, 0, $white);
imagecolortransparent($imageModule, $white);
imagepng($imageModule, $GLOBALS['xoops']->path("/modules/" . $dirname . "/assets/images/module_logo.png"));
imagepng($imageModule, $GLOBALS['xoops']->path("modules/" . $dirname . "/assets/images/module_logo.png"));
imagedestroy($imageModule);

return true;
Expand Down
21 changes: 10 additions & 11 deletions publisher/admin/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@

$op = XoopsRequest::getString('op', XoopsRequest::getString('op', 'none', 'GET'), 'POST');


switch ($op) {

case "importExecute":

$importfile = XoopsRequest::getString('importfile', 'nonselected', 'POST');
$importfile_path = $GLOBALS['xoops']->path("/modules/" . $publisher->getModule()->dirname() . "/admin/import/" . $importfile . ".php");
$importfile_path = $GLOBALS['xoops']->path("modules/" . $publisher->getModule()->dirname() . "/admin/import/" . $importfile . ".php");
include_once $importfile_path;
break;

Expand All @@ -45,11 +44,11 @@

xoops_load('XoopsFormLoader');

$module_handler = xoops_gethandler('module');
$moduleHandler = xoops_gethandler('module');

// WF-Section
/*$wfs_version = 0;
$moduleObj = $module_handler->getByDirname('wfsection');
$moduleObj = $moduleHandler->getByDirname('wfsection');
if ($moduleObj) {
$from_module_version = round($moduleObj->getVar('version') / 100, 2);
if (($from_module_version == 1.5) || $from_module_version == 1.04 || $from_module_version == 1.01 || $from_module_version == 2.07 || $from_module_version == 2.06) {
Expand All @@ -60,7 +59,7 @@

// News
$news_version = 0;
$moduleObj = $module_handler->getByDirname('news');
$moduleObj = $moduleHandler->getByDirname('news');
if ($moduleObj) {
$from_module_version = round($moduleObj->getVar('version') / 100, 2);
if (($from_module_version >= 1.1)) {
Expand All @@ -71,7 +70,7 @@

// xNews
$xnews_version = 0;
$moduleObj = $module_handler->getByDirname('xnews');
$moduleObj = $moduleHandler->getByDirname('xnews');
if ($moduleObj) {
$from_module_version = round($moduleObj->getVar('version') / 100, 2);
if (($from_module_version >= 1.1)) {
Expand All @@ -82,7 +81,7 @@

// AMS
$ams_version = 0;
$moduleObj = $module_handler->getByDirname('AMS');
$moduleObj = $moduleHandler->getByDirname('AMS');
if ($moduleObj) {
$from_module_version = round($moduleObj->getVar('version') / 100, 2);
if (($from_module_version >= 1.1)) {
Expand All @@ -93,7 +92,7 @@

// Smartsection
$smartsection_version = 0;
$moduleObj = $module_handler->getByDirname('smartsection');
$moduleObj = $moduleHandler->getByDirname('smartsection');
if ($moduleObj) {
$from_module_version = round($moduleObj->getVar('version') / 100, 2);
if (($from_module_version >= 1.1)) {
Expand All @@ -104,7 +103,7 @@

// C-Jay Content
$cjaycontent_version = 0;
$moduleObj = $module_handler->getByDirname('cjaycontent');
$moduleObj = $moduleHandler->getByDirname('cjaycontent');
if ($moduleObj) {
$from_module_version = round($moduleObj->getVar('version') / 100, 2);
if (($from_module_version >= 1.1)) {
Expand All @@ -115,7 +114,7 @@

// FmContent
$fmcontent_version = 0;
$moduleObj = $module_handler->getByDirname('fmcontent');
$moduleObj = $moduleHandler->getByDirname('fmcontent');
if ($moduleObj) {
$from_module_version = round($moduleObj->getVar('version') / 100, 2);
if (($from_module_version >= 1.1)) {
Expand All @@ -126,7 +125,7 @@

// XF-Section
/*$xfs_version = 0;
$moduleObj = $module_handler->getByDirname('xfsection');
$moduleObj = $moduleHandler->getByDirname('xfsection');
If ($moduleObj) {
$from_module_version = round($moduleObj->getVar('version') / 100, 2);
if ($from_module_version > 1.00) {
Expand Down
26 changes: 13 additions & 13 deletions publisher/admin/import/ams.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@
include_once (dirname(dirname(__DIR__))) . '/include/common.php';
publisherOpenCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT);

$module_handler = xoops_gethandler('module');
$moduleObj = $module_handler->getByDirname('ams');
$moduleHandler = xoops_gethandler('module');
$moduleObj = $moduleHandler->getByDirname('ams');
$ams_module_id = $moduleObj->getVar('mid');

$gperm_handler = xoops_gethandler('groupperm');
Expand All @@ -185,7 +185,7 @@
// get the total number of subcats for this category
// $criteria = new CriteriaCompo();
// $criteria->add(new Criteria('imagecategory', $catObj->getVar('cid'), '='));
// $childCount = intval($mylinksCatHandler->getCount($criteria));
// $childCount = (int)($mylinksCatHandler->getCount($criteria));

$criteria = new Criteria('imgcat_name', PUBLISHER_DIRNAME);
$imageCategoryId = $imageCategoryHandler->getObjects($criteria);
Expand Down Expand Up @@ -224,7 +224,7 @@

// Category image: copying to Publisher category uploads
if (($arrCat['topic_imgurl'] != 'blank.gif') && ($arrCat['topic_imgurl'] != '')) {
if (copy($GLOBALS['xoops']->path("/uploads/AMS/topics/" . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path("/uploads/" . PUBLISHER_DIRNAME . "/images/category/" . $arrCat['topic_imgurl']))) {
if (copy($GLOBALS['xoops']->path("uploads/AMS/topics/" . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path("uploads/" . PUBLISHER_DIRNAME . "/images/category/" . $arrCat['topic_imgurl']))) {
$categoryObj->setVar('image', $arrCat['topic_imgurl']);

//======== there is no need to add the category images to Image Manager, because they are handled directly from /images/category/ folder
Expand Down Expand Up @@ -259,8 +259,8 @@

//copy all images to Image Manager

$src = $GLOBALS['xoops']->path("/uploads/AMS/topics/");
$dst = $GLOBALS['xoops']->path("/uploads");
$src = $GLOBALS['xoops']->path("uploads/AMS/topics/");
$dst = $GLOBALS['xoops']->path("uploads");

PublisherUtilities::recurseCopy($src, $dst);

Expand Down Expand Up @@ -327,9 +327,9 @@
/*
// HTML Wrap
if ($arrArticle['htmlpage']) {
$pagewrap_filename = $GLOBALS['xoops']->path("/modules/wfsection/html/" .$arrArticle['htmlpage']);
$pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']);
if (file_exists($pagewrap_filename)) {
if (copy($pagewrap_filename, $GLOBALS['xoops']->path("/uploads/publisher/content/" . $arrArticle['htmlpage']))) {
if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) {
$itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]");
echo sprintf("&nbsp;&nbsp;&nbsp;&nbsp;" . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "<br/>";
}
Expand All @@ -347,9 +347,9 @@
$resultFiles = $GLOBALS['xoopsDB']->query($sql);
$allowed_mimetypes = '';
while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) {
$filename = $GLOBALS['xoops']->path("/uploads/AMS/attached/" . $arrFile['downloadname']);
$filename = $GLOBALS['xoops']->path("uploads/AMS/attached/" . $arrFile['downloadname']);
if (file_exists($filename)) {
if (copy($filename, $GLOBALS['xoops']->path("/uploads/publisher/" . $arrFile['filerealname']))) {
if (copy($filename, $GLOBALS['xoops']->path("uploads/publisher/" . $arrFile['filerealname']))) {
$fileObj = $publisher->getHandler('file')->create();
$fileObj->setVar('name', $arrFile['filerealname']);
$fileObj->setVar('description', $arrFile['filerealname']);
Expand Down Expand Up @@ -411,15 +411,15 @@

$publisher_module_id = $publisher->getModule()->mid();

$comment_handler = xoops_gethandler('comment');
$commentHandler = xoops_gethandler('comment');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('com_modid', $ams_module_id));
$comments = $comment_handler->getObjects($criteria);
$comments = $commentHandler->getObjects($criteria);
foreach ($comments as $comment) {
$comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]);
$comment->setVar('com_modid', $publisher_module_id);
$comment->setNew();
if (!$comment_handler->insert($comment)) {
if (!$commentHandler->insert($comment)) {
echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "<br />";
} else {
echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "<br />";
Expand Down
14 changes: 7 additions & 7 deletions publisher/admin/import/cjaycontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
_AM_PUBLISHER_IMPORT_RESULT
);

$module_handler = xoops_gethandler('module');
$moduleObj = $module_handler->getByDirname('cjaycontent');
$moduleHandler = xoops_gethandler('module');
$moduleObj = $moduleHandler->getByDirname('cjaycontent');
$cjaycontent_module_id = $moduleObj->getVar('mid');

$gperm_handler = xoops_gethandler('groupperm');
Expand Down Expand Up @@ -151,9 +151,9 @@
/*
// HTML Wrap
if ($arrArticle['htmlpage']) {
$pagewrap_filename = $GLOBALS['xoops']->path("/modules/wfsection/html/" .$arrArticle['htmlpage']);
$pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']);
if (file_exists($pagewrap_filename)) {
if (copy($pagewrap_filename, $GLOBALS['xoops']->path("/uploads/publisher/content/" . $arrArticle['htmlpage']))) {
if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) {
$itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]");
echo sprintf("&nbsp;&nbsp;&nbsp;&nbsp;" . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "<br/>";
}
Expand All @@ -178,15 +178,15 @@

$publisher_module_id = $publisher->getModule()->mid();

$comment_handler = xoops_gethandler('comment');
$commentHandler = xoops_gethandler('comment');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('com_modid', $cjaycontent_module_id));
$comments = $comment_handler->getObjects($criteria);
$comments = $commentHandler->getObjects($criteria);
foreach ($comments as $comment) {
$comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]);
$comment->setVar('com_modid', $publisher_module_id);
$comment->setNew();
if (!$comment_handler->insert($comment)) {
if (!$commentHandler->insert($comment)) {
echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "<br />";
} else {
echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "<br />";
Expand Down
14 changes: 7 additions & 7 deletions publisher/admin/import/fmcontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
//publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
publisherOpenCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO);

$module_handler = xoops_gethandler('module');
$moduleObj = $module_handler->getByDirname('fmcontent');
$moduleHandler = xoops_gethandler('module');
$moduleObj = $moduleHandler->getByDirname('fmcontent');
$fm_module_id = $moduleObj->getVar('mid');

$fmTopicHdlr =& xoops_getmodulehandler('topic', 'fmcontent');
Expand Down Expand Up @@ -122,8 +122,8 @@
//publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
publisherOpenCollapsableBar('fmimportgo', 'fmimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT);

$module_handler = xoops_gethandler('module');
$moduleObj = $module_handler->getByDirname('fmcontent');
$moduleHandler = xoops_gethandler('module');
$moduleObj = $moduleHandler->getByDirname('fmcontent');
$fm_module_id = $moduleObj->getVar('mid');

$gperm_handler = xoops_gethandler('groupperm');
Expand Down Expand Up @@ -319,15 +319,15 @@

$publisher_module_id = $publisher->getModule()->mid();

$comment_handler = xoops_gethandler('comment');
$commentHandler = xoops_gethandler('comment');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('com_modid', $fm_module_id));
$comments = $comment_handler->getObjects($criteria);
$comments = $commentHandler->getObjects($criteria);
foreach ($comments as $comment) {
$comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]);
$comment->setVar('com_modid', $publisher_module_id);
$comment->setNew();
if (!$comment_handler->insert($comment)) {
if (!$commentHandler->insert($comment)) {
echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "<br />\n";
} else {
echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "<br />\n";
Expand Down
Loading

0 comments on commit 2e753eb

Please sign in to comment.