| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> | 
| 21 | 21 | */ | 
| 22 | 22 | |
| 23 | -include_once __DIR__ . '/admin.php'; | |
| 23 | +include_once __DIR__.'/admin.php'; | |
| 24 | 24 | |
| 25 | 25 | // ---------------- Main ---------------- | 
| 26 | 26 |  \define('_MA_WGGITHUB_INDEX', 'Übersicht');
 | 
| @@ -20,8 +20,8 @@ | ||
| 20 | 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> | 
| 21 | 21 | */ | 
| 22 | 22 | |
| 23 | -include_once __DIR__ . '/common.php'; | |
| 24 | -include_once __DIR__ . '/main.php'; | |
| 23 | +include_once __DIR__.'/common.php'; | |
| 24 | +include_once __DIR__.'/main.php'; | |
| 25 | 25 | |
| 26 | 26 | // ---------------- Admin Index ---------------- | 
| 27 | 27 |  \define('_AM_WGGITHUB_STATISTICS', 'Statistiken');
 | 
| @@ -20,8 +20,8 @@ | ||
| 20 | 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> | 
| 21 | 21 | */ | 
| 22 | 22 | |
| 23 | -include_once __DIR__ . '/common.php'; | |
| 24 | -include_once __DIR__ . '/main.php'; | |
| 23 | +include_once __DIR__.'/common.php'; | |
| 24 | +include_once __DIR__.'/main.php'; | |
| 25 | 25 | |
| 26 | 26 | // ---------------- Admin Index ---------------- | 
| 27 | 27 |  \define('_AM_WGGITHUB_STATISTICS', 'Statistics');
 | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | public const DIRECTORY_TYPE_USER = 1; | 
| 41 | 41 | public const DIRECTORY_TYPE_ORG = 2; | 
| 42 | 42 | |
| 43 | - public const DIRECTORY_CONTENT_ALL = 0; | |
| 43 | + public const DIRECTORY_CONTENT_ALL = 0; | |
| 44 | 44 | public const DIRECTORY_CONTENT_OWN = 1; | 
| 45 | 45 | |
| 46 | 46 | // Constants for status | 
| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 | public const PERM_README_UPDATE = 3; | 
| 58 | 58 | |
| 59 | 59 | // Constants for log type | 
| 60 | - public const LOG_TYPE_NONE = 0; | |
| 60 | + public const LOG_TYPE_NONE = 0; | |
| 61 | 61 | public const LOG_TYPE_UPDATE_START = 1; | 
| 62 | 62 | public const LOG_TYPE_UPDATE_END = 2; | 
| 63 | 63 | public const LOG_TYPE_REQUEST = 3; | 
| @@ -140,7 +140,7 @@ | ||
| 140 | 140 |          $submitter = isset($GLOBALS['xoopsUser']) && \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
 | 
| 141 | 141 | // add/update all items from table repositories | 
| 142 | 142 |          foreach ($repos as $key => $repo) {
 | 
| 143 | - $fork = (bool)$repo['fork']; | |
| 143 | + $fork = (bool) $repo['fork']; | |
| 144 | 144 |              if (Constants::DIRECTORY_CONTENT_ALL == $dirContent || false === $fork) {
 | 
| 145 | 145 | $crRepositories = new \CriteriaCompo(); | 
| 146 | 146 |                  $crRepositories->add(new \Criteria('repo_nodeid', $repo['node_id']));
 | 
| @@ -164,7 +164,7 @@ | ||
| 164 | 164 |          $ret['readme']      = $this->getVar('repo_readme');
 | 
| 165 | 165 |          $ret['prerelease']  = $this->getVar('repo_prerelease');
 | 
| 166 | 166 |          $ret['release']     = $this->getVar('repo_release');
 | 
| 167 | -        $ret['approved']    = (int)$this->getVar('repo_approved') > 0 ? \_YES : \_NO;
 | |
| 167 | +        $ret['approved']    = (int) $this->getVar('repo_approved') > 0 ? \_YES : \_NO;
 | |
| 168 | 168 |          $status             = $this->getVar('repo_status');
 | 
| 169 | 169 | $ret['status'] = $status; | 
| 170 | 170 |          switch ($status) {
 | 
| @@ -149,7 +149,7 @@ discard block | ||
| 149 | 149 |                  if (Constants::STATUS_NEW === $repoStatus || Constants::STATUS_UPDATED === $repoStatus || 0 == $releasesCount) {
 | 
| 150 | 150 |                      $ghReleases = $githubClient->getReleases($repositoriesAll[$i]->getVar('repo_user'), $repositoriesAll[$i]->getVar('repo_name'));
 | 
| 151 | 151 |                      if ($releasesCount > 0) {
 | 
| 152 | -                        $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId;
 | |
| 152 | +                        $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId;
 | |
| 153 | 153 |                          if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
 | 
| 154 | 154 | return false; | 
| 155 | 155 | } | 
| @@ -159,13 +159,13 @@ discard block | ||
| 159 | 159 | $first = true; | 
| 160 | 160 | $final = false; | 
| 161 | 161 |                  foreach ($ghReleases as $ghRelease) {
 | 
| 162 | -                    if ($first || (!$final && !(bool)$ghRelease['prerelease'])) {
 | |
| 162 | +                    if ($first || (!$final && !(bool) $ghRelease['prerelease'])) {
 | |
| 163 | 163 | // save first in any case and save first final version | 
| 164 | 164 | $releasesObj = $releasesHandler->create(); | 
| 165 | 165 |                          $releasesObj->setVar('rel_repoid', $repoId);
 | 
| 166 | 166 |                          $releasesObj->setVar('rel_type', $ghRelease['type']);
 | 
| 167 | 167 |                          $releasesObj->setVar('rel_name', $ghRelease['name']);
 | 
| 168 | -                        $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease']));
 | |
| 168 | +                        $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease']));
 | |
| 169 | 169 |                          $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at']));
 | 
| 170 | 170 |                          $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']);
 | 
| 171 | 171 |                          $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']);
 | 
| @@ -177,7 +177,7 @@ discard block | ||
| 177 | 177 | } | 
| 178 | 178 | } | 
| 179 | 179 | $first = false; | 
| 180 | -                    if (false === (bool)$ghRelease['prerelease']) {
 | |
| 180 | +                    if (false === (bool) $ghRelease['prerelease']) {
 | |
| 181 | 181 | $final = true; | 
| 182 | 182 | } | 
| 183 | 183 | } | 
| @@ -215,7 +215,7 @@ discard block | ||
| 215 | 215 | // must return true otherwise releases will not be loaded | 
| 216 | 216 | return true; | 
| 217 | 217 | } | 
| 218 | -            $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId;
 | |
| 218 | +            $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId;
 | |
| 219 | 219 |              if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
 | 
| 220 | 220 | return false; | 
| 221 | 221 | } | 
| @@ -224,13 +224,13 @@ discard block | ||
| 224 | 224 | $first = true; | 
| 225 | 225 | $final = false; | 
| 226 | 226 |              foreach ($ghReleases as $ghRelease) {
 | 
| 227 | -                if ($first || (!$final && !(bool)$ghRelease['prerelease'])) {
 | |
| 227 | +                if ($first || (!$final && !(bool) $ghRelease['prerelease'])) {
 | |
| 228 | 228 | // save first in any case and save first final version | 
| 229 | 229 | $releasesObj = $releasesHandler->create(); | 
| 230 | 230 |                      $releasesObj->setVar('rel_repoid', $repoId);
 | 
| 231 | 231 |                      //$releasesObj->setVar('rel_type', $ghRelease['type']);
 | 
| 232 | 232 |                      $releasesObj->setVar('rel_name', $ghRelease['name']);
 | 
| 233 | -                    $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease']));
 | |
| 233 | +                    $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease']));
 | |
| 234 | 234 |                      $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at']));
 | 
| 235 | 235 |                      $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']);
 | 
| 236 | 236 |                      $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']);
 | 
| @@ -242,7 +242,7 @@ discard block | ||
| 242 | 242 | } | 
| 243 | 243 | } | 
| 244 | 244 | $first = false; | 
| 245 | -                if (false === (bool)$ghRelease['prerelease']) {
 | |
| 245 | +                if (false === (bool) $ghRelease['prerelease']) {
 | |
| 246 | 246 | $final = true; | 
| 247 | 247 | } | 
| 248 | 248 | } | 
| @@ -259,17 +259,17 @@ discard block | ||
| 259 | 259 | public function updateRepoReleases() | 
| 260 | 260 |      {
 | 
| 261 | 261 | // update repo_prerelease | 
| 262 | -        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases');
 | |
| 263 | -        $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid ';
 | |
| 264 | -        $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_prerelease = 1 ';
 | |
| 265 | -        $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=1));';
 | |
| 262 | +        $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases');
 | |
| 263 | +        $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid ';
 | |
| 264 | +        $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_prerelease = 1 ';
 | |
| 265 | +        $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=1));';
 | |
| 266 | 266 | $GLOBALS['xoopsDB']->queryF($sql); | 
| 267 | 267 | |
| 268 | 268 | // update repo_release | 
| 269 | -        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases');
 | |
| 270 | -        $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid ';
 | |
| 271 | -        $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_release = 1 ';
 | |
| 272 | -        $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=0));';
 | |
| 269 | +        $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases');
 | |
| 270 | +        $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid ';
 | |
| 271 | +        $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_release = 1 ';
 | |
| 272 | +        $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=0));';
 | |
| 273 | 273 | $GLOBALS['xoopsDB']->queryF($sql); | 
| 274 | 274 | |
| 275 | 275 | return true; | 
| @@ -27,13 +27,13 @@ | ||
| 27 | 27 |      switch (mb_substr($val, -1)) {
 | 
| 28 | 28 | case 'K': | 
| 29 | 29 | case 'k': | 
| 30 | - return (int)$val * 1024; | |
| 30 | + return (int) $val * 1024; | |
| 31 | 31 | case 'M': | 
| 32 | 32 | case 'm': | 
| 33 | - return (int)$val * 1048576; | |
| 33 | + return (int) $val * 1048576; | |
| 34 | 34 | case 'G': | 
| 35 | 35 | case 'g': | 
| 36 | - return (int)$val * 1073741824; | |
| 36 | + return (int) $val * 1073741824; | |
| 37 | 37 | default: | 
| 38 | 38 | return $val; | 
| 39 | 39 | } | 
| @@ -133,7 +133,7 @@ discard block | ||
| 133 | 133 | |
| 134 | 134 | case 'none': | 
| 135 | 135 |              if($topic_name) {
 | 
| 136 | - $topic_name = 'topic=' . $topic_name . '&'; | |
| 136 | + $topic_name = 'topic=' . $topic_name . '&'; | |
| 137 | 137 | } | 
| 138 | 138 | $rewrite_base = '/modules/'; | 
| 139 | 139 | $page = 'page=' . $array['content_alias']; | 
| @@ -163,7 +163,7 @@ discard block | ||
| 163 | 163 | return \XOOPS_URL . $rewrite_base . $module_name . $type . $topic_name . $id . $page . $rewrite_ext; | 
| 164 | 164 | break; | 
| 165 | 165 | |
| 166 | - case 'short': | |
| 166 | + case 'short': | |
| 167 | 167 |              if($topic_name) {
 | 
| 168 | 168 | $topic_name .= '/'; | 
| 169 | 169 | } | 
| @@ -33,7 +33,7 @@ discard block | ||
| 33 | 33 | $cat_sql .= current($cats); | 
| 34 | 34 | \array_shift($cats); | 
| 35 | 35 |          foreach ($cats as $cat) {
 | 
| 36 | - $cat_sql .= ',' . $cat; | |
| 36 | + $cat_sql .= ','.$cat; | |
| 37 | 37 | } | 
| 38 | 38 | } | 
| 39 | 39 | $cat_sql .= ')'; | 
| @@ -72,9 +72,9 @@ discard block | ||
| 72 | 72 |  {
 | 
| 73 | 73 | global $xoopsTpl, $xoTheme; | 
| 74 | 74 | $myts = MyTextSanitizer::getInstance(); | 
| 75 | - $content= $myts->undoHtmlSpecialChars($myts->displayTarea($content)); | |
| 76 | -    if(isset($xoTheme) && \is_object($xoTheme)) {
 | |
| 77 | - $xoTheme->addMeta( 'meta', 'keywords', \strip_tags($content)); | |
| 75 | + $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content)); | |
| 76 | +    if (isset($xoTheme) && \is_object($xoTheme)) {
 | |
| 77 | +        $xoTheme->addMeta('meta', 'keywords', \strip_tags($content));
 | |
| 78 | 78 |      } else {    // Compatibility for old Xoops versions
 | 
| 79 | 79 |          $xoopsTpl->assign('xoops_meta_keywords', \strip_tags($content));
 | 
| 80 | 80 | } | 
| @@ -91,8 +91,8 @@ discard block | ||
| 91 | 91 | global $xoopsTpl, $xoTheme; | 
| 92 | 92 | $myts = MyTextSanitizer::getInstance(); | 
| 93 | 93 | $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content)); | 
| 94 | -    if(isset($xoTheme) && \is_object($xoTheme)) {
 | |
| 95 | - $xoTheme->addMeta( 'meta', 'description', \strip_tags($content)); | |
| 94 | +    if (isset($xoTheme) && \is_object($xoTheme)) {
 | |
| 95 | +        $xoTheme->addMeta('meta', 'description', \strip_tags($content));
 | |
| 96 | 96 |      } else {    // Compatibility for old Xoops versions
 | 
| 97 | 97 |          $xoopsTpl->assign('xoops_meta_description', \strip_tags($content));
 | 
| 98 | 98 | } | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 |      if (0 != $lenght_id) {
 | 
| 118 | 118 | $id = $array['content_id']; | 
| 119 | 119 |          while (\strlen($id) < $lenght_id) {
 | 
| 120 | - $id = '0' . $id; | |
| 120 | + $id = '0'.$id; | |
| 121 | 121 | } | 
| 122 | 122 |      } else {
 | 
| 123 | 123 | $id = $array['content_id']; | 
| @@ -132,23 +132,23 @@ discard block | ||
| 132 | 132 |      switch ($rewrite_url) {
 | 
| 133 | 133 | |
| 134 | 134 | case 'none': | 
| 135 | -            if($topic_name) {
 | |
| 136 | - $topic_name = 'topic=' . $topic_name . '&'; | |
| 135 | +            if ($topic_name) {
 | |
| 136 | + $topic_name = 'topic='.$topic_name.'&'; | |
| 137 | 137 | } | 
| 138 | 138 | $rewrite_base = '/modules/'; | 
| 139 | - $page = 'page=' . $array['content_alias']; | |
| 140 | - return \XOOPS_URL . $rewrite_base . $module . '/' . $type . '.php?' . $topic_name . 'id=' . $id . '&' . $page . $comment; | |
| 139 | + $page = 'page='.$array['content_alias']; | |
| 140 | + return \XOOPS_URL.$rewrite_base.$module.'/'.$type.'.php?'.$topic_name.'id='.$id.'&'.$page.$comment; | |
| 141 | 141 | break; | 
| 142 | 142 | |
| 143 | 143 | case 'rewrite': | 
| 144 | -            if($topic_name) {
 | |
| 144 | +            if ($topic_name) {
 | |
| 145 | 145 | $topic_name .= '/'; | 
| 146 | 146 | } | 
| 147 | 147 |              $rewrite_base = xoops_getModuleOption('rewrite_mode', $module);
 | 
| 148 | 148 |              $rewrite_ext = xoops_getModuleOption('rewrite_ext', $module);
 | 
| 149 | 149 | $module_name = ''; | 
| 150 | -            if(xoops_getModuleOption('rewrite_name', $module)) {
 | |
| 151 | -                $module_name = xoops_getModuleOption('rewrite_name', $module) . '/';
 | |
| 150 | +            if (xoops_getModuleOption('rewrite_name', $module)) {
 | |
| 151 | +                $module_name = xoops_getModuleOption('rewrite_name', $module).'/';
 | |
| 152 | 152 | } | 
| 153 | 153 | $page = $array['content_alias']; | 
| 154 | 154 | $type .= '/'; | 
| @@ -157,21 +157,21 @@ discard block | ||
| 157 | 157 | $type = ''; | 
| 158 | 158 | } | 
| 159 | 159 |              if ('comment-edit/' === $type || 'comment-reply/' === $type || 'comment-delete/' === $type) {
 | 
| 160 | - return \XOOPS_URL . $rewrite_base . $module_name . $type . $id . '/'; | |
| 160 | + return \XOOPS_URL.$rewrite_base.$module_name.$type.$id.'/'; | |
| 161 | 161 | } | 
| 162 | 162 | |
| 163 | - return \XOOPS_URL . $rewrite_base . $module_name . $type . $topic_name . $id . $page . $rewrite_ext; | |
| 163 | + return \XOOPS_URL.$rewrite_base.$module_name.$type.$topic_name.$id.$page.$rewrite_ext; | |
| 164 | 164 | break; | 
| 165 | 165 | |
| 166 | 166 | case 'short': | 
| 167 | -            if($topic_name) {
 | |
| 167 | +            if ($topic_name) {
 | |
| 168 | 168 | $topic_name .= '/'; | 
| 169 | 169 | } | 
| 170 | 170 |              $rewrite_base = xoops_getModuleOption('rewrite_mode', $module);
 | 
| 171 | 171 |              $rewrite_ext = xoops_getModuleOption('rewrite_ext', $module);
 | 
| 172 | 172 | $module_name = ''; | 
| 173 | -            if(xoops_getModuleOption('rewrite_name', $module)) {
 | |
| 174 | -                $module_name = xoops_getModuleOption('rewrite_name', $module) . '/';
 | |
| 173 | +            if (xoops_getModuleOption('rewrite_name', $module)) {
 | |
| 174 | +                $module_name = xoops_getModuleOption('rewrite_name', $module).'/';
 | |
| 175 | 175 | } | 
| 176 | 176 | $page = $array['content_alias']; | 
| 177 | 177 | $type .= '/'; | 
| @@ -179,10 +179,10 @@ discard block | ||
| 179 | 179 | $type = ''; | 
| 180 | 180 | } | 
| 181 | 181 |              if ('comment-edit/' === $type || 'comment-reply/' === $type || 'comment-delete/' === $type) {
 | 
| 182 | - return \XOOPS_URL . $rewrite_base . $module_name . $type . $id . '/'; | |
| 182 | + return \XOOPS_URL.$rewrite_base.$module_name.$type.$id.'/'; | |
| 183 | 183 | } | 
| 184 | 184 | |
| 185 | - return \XOOPS_URL . $rewrite_base . $module_name . $type . $topic_name . $page . $rewrite_ext; | |
| 185 | + return \XOOPS_URL.$rewrite_base.$module_name.$type.$topic_name.$page.$rewrite_ext; | |
| 186 | 186 | break; | 
| 187 | 187 | } | 
| 188 | 188 | return null; |