diff --git a/assets/modules/easy2/.version b/assets/modules/easy2/.version index c2c428e..922aca3 100644 --- a/assets/modules/easy2/.version +++ b/assets/modules/easy2/.version @@ -1 +1 @@ -1.4.12-pl \ No newline at end of file +1.4.13-rc1 \ No newline at end of file diff --git a/assets/modules/easy2/changes.english.txt b/assets/modules/easy2/changes.english.txt index 921c8e8..875a595 100644 --- a/assets/modules/easy2/changes.english.txt +++ b/assets/modules/easy2/changes.english.txt @@ -3,6 +3,10 @@ ) _) / \\___ \ ) / / __/ ( (_ \/ \/ (_/\/ (_/\ ) _) ) / ) / (____)\_/\_/(____/(__/ (____) \___/\_/\_/\____/\____/(____)(__\_)(__/ +***************** 1.4.13-rc1 ****************** ++ fixed bug on counting files of directory that has thumbnail specified ++ modified queries + ***************** 1.4.12-pl ****************** + replaced mysql_escape_string to mysql_real_escape_string on comments.easy2gallery.php diff --git a/assets/modules/easy2/comments.easy2gallery.php b/assets/modules/easy2/comments.easy2gallery.php index 7bb5cb9..f4a4b7a 100644 --- a/assets/modules/easy2/comments.easy2gallery.php +++ b/assets/modules/easy2/comments.easy2gallery.php @@ -34,7 +34,7 @@ sh_err('MySQL query error for configs'); die; } else { - while ($row = mysql_fetch_array($e2g_res)) { + while ($row = mysql_fetch_assoc($e2g_res)) { $e2g[$row['cfg_key']] = $row['cfg_val']; } } @@ -149,7 +149,7 @@ . 'AND STATUS=1 ORDER BY id DESC ' . 'LIMIT ' . ($cpn * $e2g['ecl']) . ', ' . $e2g['ecl']); $i = 0; -while ($l = mysql_fetch_array($res, MYSQL_ASSOC)) { +while ($l = mysql_fetch_assoc($res)) { $l['i'] = $i % 2; @@ -254,7 +254,7 @@ function getChunk($name) { $res = mysql_query('SELECT * FROM ' . $table_prefix . "site_htmlsnippets WHERE name='" . mysql_real_escape_string($name) . "'"); if (mysql_num_rows($res) > 0) { - $row = mysql_fetch_array($res, MYSQL_ASSOC); + $row = mysql_fetch_assoc($res); return $row['snippet']; } else { return false; diff --git a/assets/modules/easy2/extras/tv.easy2gallery.php b/assets/modules/easy2/extras/tv.easy2gallery.php index 756c3dc..7720281 100644 --- a/assets/modules/easy2/extras/tv.easy2gallery.php +++ b/assets/modules/easy2/extras/tv.easy2gallery.php @@ -19,7 +19,7 @@ $childrenDirs = array(); if ($queryDir) { - while ($l = mysql_fetch_array($queryDir, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($queryDir)) { $childrenDirs[$l['cat_id']]['parent_id'] = $l['parent_id']; $childrenDirs[$l['cat_id']]['cat_id'] = $l['cat_id']; $childrenDirs[$l['cat_id']]['cat_name'] = $l['cat_name']; diff --git a/assets/modules/easy2/includes/controllers/module.countfiles.php b/assets/modules/easy2/includes/controllers/module.countfiles.php index 526ccc2..eef010b 100644 --- a/assets/modules/easy2/includes/controllers/module.countfiles.php +++ b/assets/modules/easy2/includes/controllers/module.countfiles.php @@ -27,7 +27,7 @@ if (!$q) die(__FILE__ . ': MySQL query error for configs'); else { - while ($row = mysql_fetch_array($q)) { + while ($row = mysql_fetch_assoc($q)) { $e2g[$row['cfg_key']] = $row['cfg_val']; } } diff --git a/assets/modules/easy2/includes/controllers/module.gallery.default.grid.php b/assets/modules/easy2/includes/controllers/module.gallery.default.grid.php index b6d3ed2..688cf31 100644 --- a/assets/modules/easy2/includes/controllers/module.gallery.default.grid.php +++ b/assets/modules/easy2/includes/controllers/module.gallery.default.grid.php @@ -27,7 +27,7 @@ if (!$q) die(__FILE__ . ': MySQL query error for configs'); else { - while ($row = mysql_fetch_array($q)) { + while ($row = mysql_fetch_assoc($q)) { $e2g[$row['cfg_key']] = $row['cfg_val']; } } @@ -94,7 +94,7 @@ die($msg); } $fetchDirs = array(); - while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectDirs)) { $fetchDirs[$l['cat_name']] = $l; } mysql_free_result($querySelectDirs); @@ -113,7 +113,7 @@ die($msg); } $fetchFiles = array(); - while ($l = mysql_fetch_array($querySelectFiles, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectFiles)) { $fetchFiles[$l['filename']] = $l; } mysql_free_result($querySelectFiles); diff --git a/assets/modules/easy2/includes/controllers/module.gallery.default.thumb.php b/assets/modules/easy2/includes/controllers/module.gallery.default.thumb.php index 570d6f9..bea8778 100644 --- a/assets/modules/easy2/includes/controllers/module.gallery.default.thumb.php +++ b/assets/modules/easy2/includes/controllers/module.gallery.default.thumb.php @@ -27,7 +27,7 @@ if (!$q) die(__FILE__ . ': MySQL query error for configs'); else { - while ($row = mysql_fetch_array($q)) { + while ($row = mysql_fetch_assoc($q)) { $e2g[$row['cfg_key']] = $row['cfg_val']; } } @@ -86,7 +86,7 @@ die($msg); } $fetchDirs = array(); - while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectDirs)) { $fetchDirs[$l['cat_name']] = $l; } mysql_free_result($querySelectDirs); @@ -103,7 +103,7 @@ die($msg); } $fetchFiles = array(); - while ($l = mysql_fetch_array($querySelectFiles, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectFiles)) { $fetchFiles[$l['filename']] = $l; } mysql_free_result($querySelectFiles); diff --git a/assets/modules/easy2/includes/controllers/module.gallery.rescan.grid.php b/assets/modules/easy2/includes/controllers/module.gallery.rescan.grid.php index c1eb5bc..fd97402 100644 --- a/assets/modules/easy2/includes/controllers/module.gallery.rescan.grid.php +++ b/assets/modules/easy2/includes/controllers/module.gallery.rescan.grid.php @@ -27,7 +27,7 @@ if (!$q) die(__FILE__ . ': MySQL query error for configs'); else { - while ($row = mysql_fetch_array($q)) { + while ($row = mysql_fetch_assoc($q)) { $e2g[$row['cfg_key']] = $row['cfg_val']; } } @@ -95,7 +95,7 @@ $rows = array(); // for return $mdirs = array(); - while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectDirs)) { $mdirs[$l['cat_name']] = $l; } mysql_free_result($querySelectDirs); @@ -386,7 +386,7 @@ die($msg); } $mfiles = array(); - while ($l = mysql_fetch_array($querySelectFiles, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectFiles)) { $mfiles[$l['filename']] = $l; } mysql_free_result($querySelectFiles); diff --git a/assets/modules/easy2/includes/controllers/module.gallery.rescan.thumb.php b/assets/modules/easy2/includes/controllers/module.gallery.rescan.thumb.php index d824211..f311957 100644 --- a/assets/modules/easy2/includes/controllers/module.gallery.rescan.thumb.php +++ b/assets/modules/easy2/includes/controllers/module.gallery.rescan.thumb.php @@ -27,7 +27,7 @@ if (!$q) die(__FILE__ . ': MySQL query error for configs'); else { - while ($row = mysql_fetch_array($q)) { + while ($row = mysql_fetch_assoc($q)) { $e2g[$row['cfg_key']] = $row['cfg_val']; } } @@ -95,7 +95,7 @@ $rows = array(); // for return $mdirs = array(); - while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectDirs)) { $mdirs[$l['cat_name']] = $l; } mysql_free_result($querySelectDirs); @@ -459,7 +459,7 @@ die($msg); } $mfiles = array(); - while ($l = mysql_fetch_array($querySelectFiles, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectFiles)) { $mfiles[$l['filename']] = $l; } mysql_free_result($querySelectFiles); diff --git a/assets/modules/easy2/includes/controllers/module.gallery.tag.grid.php b/assets/modules/easy2/includes/controllers/module.gallery.tag.grid.php index 6a7776a..b6ce504 100644 --- a/assets/modules/easy2/includes/controllers/module.gallery.tag.grid.php +++ b/assets/modules/easy2/includes/controllers/module.gallery.tag.grid.php @@ -27,7 +27,7 @@ if (!$q) die(__FILE__ . ': MySQL query error for configs'); else { - while ($row = mysql_fetch_array($q)) { + while ($row = mysql_fetch_assoc($q)) { $e2g[$row['cfg_key']] = $row['cfg_val']; } } @@ -85,7 +85,7 @@ } $fetchDirs = array(); -while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) { +while ($l = mysql_fetch_assoc($querySelectDirs)) { $fetchDirs[$l['cat_name']] = $l; } mysql_free_result($querySelectDirs); @@ -104,7 +104,7 @@ } $fetchFiles = array(); -while ($l = mysql_fetch_array($querySelectFiles, MYSQL_ASSOC)) { +while ($l = mysql_fetch_assoc($querySelectFiles)) { $fetchFiles[$l['filename']] = $l; } mysql_free_result($querySelectFiles); diff --git a/assets/modules/easy2/includes/controllers/module.gallery.tag.thumb.php b/assets/modules/easy2/includes/controllers/module.gallery.tag.thumb.php index 7db0de9..d51c598 100644 --- a/assets/modules/easy2/includes/controllers/module.gallery.tag.thumb.php +++ b/assets/modules/easy2/includes/controllers/module.gallery.tag.thumb.php @@ -27,7 +27,7 @@ if (!$q) die(__FILE__ . ': MySQL query error for configs'); else { - while ($row = mysql_fetch_array($q)) { + while ($row = mysql_fetch_assoc($q)) { $e2g[$row['cfg_key']] = $row['cfg_val']; } } @@ -85,7 +85,7 @@ } $fetchDirs = array(); -while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) { +while ($l = mysql_fetch_assoc($querySelectDirs)) { $fetchDirs[$l['cat_name']] = $l; } mysql_free_result($querySelectDirs); @@ -104,7 +104,7 @@ } $fetchFiles = array(); -while ($l = mysql_fetch_array($querySelectFiles, MYSQL_ASSOC)) { +while ($l = mysql_fetch_assoc($querySelectFiles)) { $fetchFiles[$l['filename']] = $l; } mysql_free_result($querySelectFiles); diff --git a/assets/modules/easy2/includes/controllers/module.synchro.php b/assets/modules/easy2/includes/controllers/module.synchro.php index 748eeb9..11b7561 100644 --- a/assets/modules/easy2/includes/controllers/module.synchro.php +++ b/assets/modules/easy2/includes/controllers/module.synchro.php @@ -27,7 +27,7 @@ if (!$q) die(__FILE__ . ': MySQL query error for configs'); else { - while ($row = mysql_fetch_array($q)) { + while ($row = mysql_fetch_assoc($q)) { $e2g[$row['cfg_key']] = $row['cfg_val']; } } diff --git a/assets/modules/easy2/includes/models/TTree.class.php b/assets/modules/easy2/includes/models/TTree.class.php index 6637922..e4cbe06 100644 --- a/assets/modules/easy2/includes/models/TTree.class.php +++ b/assets/modules/easy2/includes/models/TTree.class.php @@ -57,7 +57,7 @@ function insert($name, $parentId = 1) { $this->error = 'Parent ID not found (INSERT)'; return false; } - $parent = mysql_fetch_array($result, MYSQL_ASSOC); + $parent = mysql_fetch_assoc($result); // Update the all root parents' data first. $query = 'UPDATE ' . $this->table . ' SET ' @@ -117,7 +117,7 @@ function update($id, $name, $parentId = false) { . $this->id . ' = ' . $id; $result = mysql_query($query); - $c = mysql_fetch_array($result, MYSQL_ASSOC); + $c = mysql_fetch_assoc($result); if ($c[$this->parent] != $parentId) { if (!$this->replace($id, $parentId, $c)) @@ -159,7 +159,7 @@ function replace($id, $to_id, $c = false) { $result_select_c = mysql_query($select_c); // set the old parent's handler variable - $c = mysql_fetch_array($result_select_c, MYSQL_ASSOC); + $c = mysql_fetch_assoc($result_select_c); } // Данные о новой родительской ветви @@ -174,7 +174,7 @@ function replace($id, $to_id, $c = false) { return false; } // set the new parent's handler variable - $to = mysql_fetch_array($result_select_to, MYSQL_ASSOC); + $to = mysql_fetch_assoc($result_select_to); // ***************************************** ERROR HANDLERS **************************************** // @@ -359,7 +359,7 @@ function delete($id) { } // get the parent's data - $cat = mysql_fetch_array($result, MYSQL_ASSOC); + $cat = mysql_fetch_assoc($result); // Список вложенний // List of nested ??? @@ -402,7 +402,7 @@ function reindex() { } // get the parent's data - $cat = mysql_fetch_array($result, MYSQL_ASSOC); + $cat = mysql_fetch_assoc($result); // ************** SET MARGIN VALUE OF THE deleted branches AS THE RENUMBERING CONTROL ************** // $razn = $cat[$this->right] - $cat[$this->left] + 1; @@ -470,7 +470,7 @@ function sql2array($sql, $keyField='') { function result2array($q, $keyField='') { $Result = array(); - while ($Data = mysql_fetch_array($q, MYSQL_ASSOC)) + while ($Data = mysql_fetch_assoc($q)) if (empty($keyField)) $Result[] = $Data; //else $Result[$Data[$keyField]] = $Data; diff --git a/assets/modules/easy2/includes/models/e2g.module.class.php b/assets/modules/easy2/includes/models/e2g.module.class.php index 3470561..7a7c209 100644 --- a/assets/modules/easy2/includes/models/e2g.module.class.php +++ b/assets/modules/easy2/includes/models/e2g.module.class.php @@ -1020,7 +1020,7 @@ public function synchro($path, $pid, $userId = null) { } $mdirs = array(); - while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectDirs)) { $mdirs[$l['cat_name']]['id'] = $l['cat_id']; // goldsky -- to be connected between db <--> fs $mdirs[$l['cat_name']]['name'] = $l['cat_name']; } @@ -1037,7 +1037,7 @@ public function synchro($path, $pid, $userId = null) { } $mfiles = array(); - while ($l = mysql_fetch_array($querySelectFile, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectFile)) { $mfiles[$l['filename']]['id'] = $l['id']; $mfiles[$l['filename']]['name'] = $l['filename']; } @@ -1250,7 +1250,7 @@ private function _checkFileDuplication($name, $pid) { $selectCheck = 'SELECT filename FROM ' . $this->modx->db->config['table_prefix'] . 'easy2_files ' . 'WHERE filename = \'' . $name . '\' AND dir_id = \'' . $pid . '\''; $queryCheck = @mysql_query($selectCheck); - while ($l = @mysql_fetch_array($queryCheck)) { + while ($l = @mysql_fetch_assoc($queryCheck)) { $fetchRow[$l['filename']] = $l['filename']; } mysql_free_result($queryCheck); @@ -1277,7 +1277,7 @@ private function _checkFileDuplication($name, $pid) { $recursiveCheckSelect = 'SELECT * FROM ' . $this->modx->db->config['table_prefix'] . 'easy2_files ' . 'WHERE filename=\'' . $newFilename . '\' AND dir_id = \'' . $pid . '\''; $recursiveCheckQuery = @mysql_query($recursiveCheckSelect); - while ($l = @mysql_fetch_array($recursiveCheckQuery)) { + while ($l = @mysql_fetch_assoc($recursiveCheckQuery)) { $recursiveFetchRow[$l['filename']] = $l['filename']; } mysql_free_result($recursiveCheckQuery); @@ -1303,7 +1303,7 @@ private function _checkFolderDuplication($name, $pid) { $selectCheck = 'SELECT cat_name FROM ' . $this->modx->db->config['table_prefix'] . 'easy2_dirs ' . 'WHERE cat_name = \'' . $name . '\' AND parent_id = \'' . $pid . '\''; $queryCheck = @mysql_query($selectCheck); - while ($l = @mysql_fetch_array($queryCheck)) { + while ($l = @mysql_fetch_assoc($queryCheck)) { $fetchRow[$l['cat_name']] = $l['cat_name']; } mysql_free_result($queryCheck); @@ -1329,7 +1329,7 @@ private function _checkFolderDuplication($name, $pid) { $recursiveCheckSelect = 'SELECT cat_name FROM ' . $this->modx->db->config['table_prefix'] . 'easy2_dirs ' . 'WHERE cat_name=\'' . $newDirName . '\' AND parent_id = \'' . $pid . '\''; $recursiveCheckQuery = @mysql_query($recursiveCheckSelect); - while ($l = @mysql_fetch_array($recursiveCheckQuery)) { + while ($l = @mysql_fetch_assoc($recursiveCheckQuery)) { $recursiveFetchRow[$l['cat_name']] = $l['cat_name']; } mysql_free_result($recursiveCheckQuery); @@ -1421,7 +1421,7 @@ private function _dirDropDownOptions($parentId = 0, $selected = 0, $jsActions = $numDir = @mysql_num_rows($querySelectDirs); $childrenDirs = array(); - while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectDirs)) { $childrenDirs[$l['cat_id']]['parent_id'] = $l['parent_id']; $childrenDirs[$l['cat_id']]['cat_id'] = $l['cat_id']; $childrenDirs[$l['cat_id']]['cat_name'] = $l['cat_name']; @@ -1563,7 +1563,7 @@ private function _tagOptions($tag) { $numDirTags = mysql_num_rows($queryDirTags); - while ($l = mysql_fetch_array($queryDirTags)) { + while ($l = mysql_fetch_assoc($queryDirTags)) { if ($l['cat_tag'] == '' || $l['cat_tag'] == NULL) continue; $tagOptions[] = $l['cat_tag']; @@ -1580,7 +1580,7 @@ private function _tagOptions($tag) { $numFileTags = mysql_num_rows($queryFileTags); - while ($l = mysql_fetch_array($queryFileTags)) { + while ($l = mysql_fetch_assoc($queryFileTags)) { if ($l['tag'] == '' || $l['tag'] == NULL) continue; $tagOptions[] = $l['tag']; @@ -1904,7 +1904,7 @@ private function _showChecked($post) { return FALSE; } - $l = mysql_fetch_array($querySelectDirStatus, MYSQL_ASSOC); + $l = mysql_fetch_assoc($querySelectDirStatus); mysql_free_result($querySelectDirStatus); if ($l['cat_visible'] == '1') { @@ -1939,7 +1939,7 @@ private function _showChecked($post) { return FALSE; } - $l = mysql_fetch_array($querySelectFileStatus, MYSQL_ASSOC); + $l = mysql_fetch_assoc($querySelectFileStatus); mysql_free_result($querySelectFileStatus); if ($l['status'] == '1') { @@ -1995,7 +1995,7 @@ private function _hideChecked($post) { return FALSE; } - $l = mysql_fetch_array($querySelectDirStatus, MYSQL_ASSOC); + $l = mysql_fetch_assoc($querySelectDirStatus); mysql_free_result($querySelectDirStatus); if ($l['cat_visible'] == '0') { @@ -2030,7 +2030,7 @@ private function _hideChecked($post) { return FALSE; } - $l = mysql_fetch_array($querySelectFileStatus, MYSQL_ASSOC); + $l = mysql_fetch_assoc($querySelectFileStatus); mysql_free_result($querySelectFileStatus); if ($l['status'] == '0') { @@ -2610,7 +2610,7 @@ private function _moveChecked($post) { . 'FROM ' . $this->modx->db->config['table_prefix'] . 'easy2_files ' . 'WHERE id=' . (int) $k ); - while ($l = mysql_fetch_array($filesRes)) { + while ($l = mysql_fetch_assoc($filesRes)) { $files[$l['id']]['dir_id'] = $l['dir_id']; } mysql_free_result($filesRes); @@ -2630,7 +2630,7 @@ private function _moveChecked($post) { . 'AND B.dir_id=' . (int) $post['newparent'] ; $filesCheckQuery = mysql_query($filesCheckSelect); - while ($f = mysql_fetch_array($filesCheckQuery)) { + while ($f = mysql_fetch_assoc($filesCheckQuery)) { $filesCheck[$f['ai']]['filename'] = $f['bf']; } mysql_free_result($filesCheckQuery); @@ -3072,7 +3072,7 @@ private function _tagAddChecked($post) { $_SESSION['easy2err'][] = __LINE__ . ' : #' . mysql_errno() . ' ' . mysql_error() . '
' . $selectDirTags; return FALSE; } - while ($l = mysql_fetch_array($querySelectDirTags)) { + while ($l = mysql_fetch_assoc($querySelectDirTags)) { $dirTags = $l['cat_tag']; } mysql_free_result($querySelectDirTags); @@ -3130,7 +3130,7 @@ private function _tagAddChecked($post) { $_SESSION['easy2err'][] = __LINE__ . ' : #' . mysql_errno() . ' ' . mysql_error() . '
' . $selectFileTags; return FALSE; } - while ($l = mysql_fetch_array($querySelectFileTags)) { + while ($l = mysql_fetch_assoc($querySelectFileTags)) { $fileTags = $l['tag']; } mysql_free_result($querySelectFileTags); @@ -3214,7 +3214,7 @@ private function _tagRemoveChecked($post) { $_SESSION['easy2err'][] = __LINE__ . ' : #' . mysql_errno() . ' ' . mysql_error() . '
' . $selectDirTags; return FALSE; } - while ($l = mysql_fetch_array($querySelectDirTags)) { + while ($l = mysql_fetch_assoc($querySelectDirTags)) { $dirTags = $l['cat_tag']; } mysql_free_result($querySelectDirTags); @@ -3271,7 +3271,7 @@ private function _tagRemoveChecked($post) { $_SESSION['easy2err'][] = __LINE__ . ' : #' . mysql_errno() . ' ' . mysql_error() . '
' . $selectFileTags; return FALSE; } - while ($l = mysql_fetch_array($querySelectFileTags)) { + while ($l = mysql_fetch_assoc($querySelectFileTags)) { $fileTags = $l['tag']; } mysql_free_result($querySelectFileTags); @@ -4654,7 +4654,7 @@ public function loadSettings() { if (!empty($configTablesValues)) { $configsQuery = $this->modx->db->select('*', $this->modx->db->config['table_prefix'] . 'easy2_configs'); if ($configsQuery) { - while ($row = mysql_fetch_array($configsQuery)) { + while ($row = mysql_fetch_assoc($configsQuery)) { $configsKey[$row['cfg_key']] = $row['cfg_key']; $e2g[$row['cfg_key']] = $row['cfg_val']; } diff --git a/assets/modules/easy2/includes/models/e2g.public.class.php b/assets/modules/easy2/includes/models/e2g.public.class.php index af6dc90..cc75a26 100644 --- a/assets/modules/easy2/includes/models/e2g.public.class.php +++ b/assets/modules/easy2/includes/models/e2g.public.class.php @@ -249,7 +249,7 @@ public function getDirInfo($dirId, $field) { return; } } - while ($l = mysql_fetch_array($res)) { + while ($l = mysql_fetch_assoc($res)) { $dirInfo[$field] = $l[$field]; } mysql_free_result($res); @@ -280,7 +280,7 @@ public function getFileInfo($fileId, $field) { if (!($res = mysql_query($q))) return (__LINE__ . ' Wrong field: ' . $field); - while ($l = mysql_fetch_array($res)) { + while ($l = mysql_fetch_assoc($res)) { $fileInfo[$field] = $l[$field]; } mysql_free_result($res); @@ -527,7 +527,7 @@ public function plugin($e2gEvtName, $e2gEvtParams = array(), $e2gPluginName = NU echo __METHOD__ . ', ' . __LINE__ . ' : ' . mysql_error() . '
' . $selectIndexFile; return FALSE; } else { - while ($row = mysql_fetch_array($queryIndexFile)) { + while ($row = mysql_fetch_assoc($queryIndexFile)) { $indexFiles[] = $row['indexfile']; } @@ -584,10 +584,11 @@ public function folderImg($gid, $gdir) { return FALSE; } - while ($l = mysql_fetch_array($queryDbFile, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($queryDbFile)) { $catThumbId = $l['cat_thumb_id']; } + $specifiedFolderImg = ''; if (!empty($catThumbId)) { $catThumbPath = $this->getPath($this->getFileInfo($catThumbId, 'dir_id')); $catThumbName = $this->getFileInfo($catThumbId, 'filename'); @@ -604,12 +605,8 @@ public function folderImg($gid, $gdir) { return FALSE; } - while ($l = mysql_fetch_array($queryThumbFile, MYSQL_ASSOC)) { - $file = $l; - } + $specifiedFolderImg = mysql_fetch_assoc($queryThumbFile); mysql_free_result($queryThumbFile); - - return $file; } } @@ -658,7 +655,7 @@ public function folderImg($gid, $gdir) { return FALSE; } - while ($l = mysql_fetch_array($queryFiles, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($queryFiles)) { $files[] = $l; } mysql_free_result($queryFiles); @@ -672,17 +669,21 @@ public function folderImg($gid, $gdir) { * system or not, and stops at which ever returns TRUE. */ $folderImgInfos = array(); - foreach ($files as $file) { - // search image for subdir - $getPath = $this->getPath($file['dir_id']); - $imagePath = $this->e2gDecode($gdir . $getPath . $file['filename']); - if (!$this->validFile($imagePath)) { - continue; - } else { - $folderImgInfos = $file; - break; - } - } + if (empty($specifiedFolderImg)) { + foreach ($files as $file) { + // search image for subdir + $getPath = $this->getPath($file['dir_id']); + $imagePath = $this->e2gDecode($gdir . $getPath . $file['filename']); + if (!$this->validFile($imagePath)) { + continue; + } else { + $folderImgInfos = $file; + break; + } + } + } else { + $folderImgInfos = $specifiedFolderImg; + } $folderImgInfos['count'] = $countFiles; /** @@ -777,7 +778,7 @@ public function getPath($dirId, $option='cat_name', $format='string') { $resultArray = array(); $resultString = array(); $result = ''; - while ($l = mysql_fetch_array($queryDir)) { + while ($l = mysql_fetch_assoc($queryDir)) { if ($option != 'cat_name' && empty($l[$option])) $l[$option] = $l['cat_name']; $resultArray[$l['cat_id']] = $l[$option]; diff --git a/assets/modules/easy2/includes/models/e2g.snippet.class.php b/assets/modules/easy2/includes/models/e2g.snippet.class.php index c6d8e54..8e57225 100644 --- a/assets/modules/easy2/includes/models/e2g.snippet.class.php +++ b/assets/modules/easy2/includes/models/e2g.snippet.class.php @@ -415,7 +415,7 @@ private function _imageThumbs() { return; } $fileThumbs = array(); - while ($l = mysql_fetch_array($querySelectFiles, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectFiles)) { $thumbPlaceholders = $this->_loadThumbPlaceholders($l); if ($thumbPlaceholders === FALSE) { continue; @@ -552,7 +552,7 @@ private function _dirThumbs() { //* Fill up the current directory's thumbnails content */ //******************************************************************/ $dirThumbs = array(); - while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectDirs)) { if (isset($this->e2gSnipCfg['static_tag'])) { $l['permalink'] = $this->e2gSnipCfg['e2g_static_instances'] . '_' . $this->e2gSnipCfg['static_tag']; $permalink = $this->e2gSnipCfg['e2g_static_instances'] . '_' . $this->e2gSnipCfg['static_tag']; @@ -624,7 +624,7 @@ private function _dirThumbs() { // fill up the dir list with content $dirThumbs[] = $this->filler($this->getTpl('dir_tpl'), $l); - } // while ($l = mysql_fetch_array($querySelectDirs, MYSQL_ASSOC)) + } // while ($l = mysql_fetch_assoc($querySelectDirs)) mysql_free_result($querySelectDirs); return $dirThumbs; @@ -752,7 +752,7 @@ public function imgFile() { $phs['wrapper'] = $this->e2gSnipCfg['e2g_wrapper']; $imgThumbs = array(); - while ($l = mysql_fetch_array($querySelectFiles, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectFiles)) { $thumbPlaceholder = $this->_loadThumbPlaceholders($l); if ($thumbPlaceholder === FALSE) return FALSE; @@ -833,7 +833,7 @@ public function imgRandom() { $phs['wrapper'] = $this->e2gSnipCfg['e2g_wrapper']; $imgThumbs = array(); - while ($l = mysql_fetch_array($querySelectFiles, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectFiles)) { $thumbPlaceholder = $this->_loadThumbPlaceholders($l); if ($thumbPlaceholder === FALSE) return FALSE; @@ -1514,7 +1514,7 @@ public function landingPage($fileId) { $this->modx->regClientStartupScript($this->e2gSnipCfg['js']); } - $select = 'SELECT * FROM ' . $this->modx->db->config['table_prefix'] . 'easy2_files WHERE id = ' . $fileId; + $select = 'SELECT * FROM ' . $this->modx->db->config['table_prefix'] . 'easy2_files WHERE id = ' . intval($fileId); $query = mysql_query($select); if (!$query) { @@ -1523,7 +1523,7 @@ public function landingPage($fileId) { } $l = array(); - while ($fetch = mysql_fetch_array($query)) { + while ($fetch = mysql_fetch_assoc($query)) { $l = $fetch; $path = $this->getPath($fetch['dir_id']); @@ -1624,6 +1624,10 @@ public function landingPage($fileId) { */ private function _comments($fileId) { $cpn = (empty($this->_sanitizedGets['cpn']) || !is_numeric($this->_sanitizedGets['cpn'])) ? 0 : (int) $this->_sanitizedGets['cpn']; + $fileId = intval($fileId); + if ($fileId === 0) { + return FALSE; + } // Get a key from https://www.google.com/recaptcha/admin/create $recaptchalib = realpath(E2G_SNIPPET_PATH . 'includes/recaptchalib.php'); @@ -1732,7 +1736,7 @@ private function _comments($fileId) { } $rowClassNum = 0; - while ($l = mysql_fetch_array($querySelectComments, MYSQL_ASSOC)) { + while ($l = mysql_fetch_assoc($querySelectComments)) { $l['i'] = $rowClassNum % 2; $l['name_permalink'] = ' '; $l['name_w_permalink'] = 'getPath($l['dir_id']); $filePath = str_replace('%2F', '/', rawurlencode($this->e2gModCfg['gdir'] . $path['string'] . $l['filename'])); ?> @@ -280,7 +280,7 @@ . 'FROM ' . $this->modx->db->config['table_prefix'] . 'easy2_ignoredip ' . 'ORDER BY id DESC'); $rowNum = 0; // only for row coloring - while ($ign = mysql_fetch_array($ign_ip_res, MYSQL_ASSOC)) { + while ($ign = mysql_fetch_assoc($ign_ip_res)) { ?> > diff --git a/assets/modules/easy2/includes/tpl/pages/file.comments.inc.php b/assets/modules/easy2/includes/tpl/pages/file.comments.inc.php index 137508e..3881eed 100644 --- a/assets/modules/easy2/includes/tpl/pages/file.comments.inc.php +++ b/assets/modules/easy2/includes/tpl/pages/file.comments.inc.php @@ -3,7 +3,7 @@ die("INCLUDE_ORDERING_ERROR

Please use the MODx Content Manager instead of accessing this file directly."); $res = mysql_query('SELECT * FROM ' . $this->modx->db->config['table_prefix'] . 'easy2_files WHERE id=' . (int) $this->sanitizedGets['file_id']); -$row = mysql_fetch_array($res, MYSQL_ASSOC); +$row = mysql_fetch_assoc($res); mysql_free_result($res); ?>