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 | // This program is free software; you can redistribute it and/or modify // |
||
5 | // it under the terms of the GNU General Public License as published by // |
||
6 | // the Free Software Foundation; either version 2 of the License, or // |
||
7 | // (at your option) any later version. // |
||
8 | // // |
||
9 | // You may not change or alter any portion of this comment or credits // |
||
10 | // of supporting developers from this source code or any supporting // |
||
11 | // source code which is considered copyrighted (c) material of the // |
||
12 | // original comment or credit authors. // |
||
13 | // // |
||
14 | // This program is distributed in the hope that it will be useful, // |
||
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
17 | // GNU General Public License for more details. // |
||
18 | // // |
||
19 | // You should have received a copy of the GNU General Public License // |
||
20 | // along with this program; if not, write to the Free Software // |
||
21 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
22 | // ------------------------------------------------------------------------ // |
||
23 | // Author: phppp (D.J., [email protected]) // |
||
24 | // URL: https://xoops.org // |
||
25 | // Project: Article Project // |
||
26 | // ------------------------------------------------------------------------ // |
||
27 | use Xmf\Request; |
||
28 | use XoopsModules\Planet; |
||
29 | /** @var Planet\Helper $helper */ |
||
30 | $helper = Planet\Helper::getInstance(); |
||
31 | |||
32 | include __DIR__ . '/header.php'; |
||
33 | |||
34 | $blog_id = Request::getInt('blog', Request::getInt('blog', 0, 'POST'), 'GET'); //(int)(!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0)); |
||
35 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
||
36 | if ($blog_id > 0) { |
||
37 | $blog = $blogHandler->get($blog_id); |
||
38 | $count = $blogHandler->do_update($blog); |
||
39 | redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php?blog=' . $blog_id, 2, sprintf(planet_constant('MD_UPDATED'), (int)$count)); |
||
40 | } |
||
41 | if (planetGetCookie('upd') + 30 * 60 > time()) { |
||
42 | return; |
||
43 | } |
||
44 | PlanetUtility::planetSetCookie('upd', time()); |
||
45 | $start = 0; |
||
46 | @include XOOPS_CACHE_PATH . '/' . $xoopsModule->getVar('dirname') . '_update.php'; |
||
0 ignored issues
–
show
|
|||
47 | $criteria = new \Criteria('blog_status', 0, '>'); |
||
48 | $criteria->setSort('blog_id'); |
||
49 | $criteria->setStart($start); |
||
50 | $criteria->setLimit($helper->getConfig('blogs_perupdate')); |
||
51 | $blogs = $blogHandler->getAll($criteria); |
||
52 | foreach (array_keys($blogs) as $id) { |
||
53 | $blogHandler->do_update($blogs[$id]); |
||
54 | } |
||
55 | $start += count($blogs); |
||
56 | if (count($blogs) < $helper->getConfig('blogs_perupdate')) { |
||
57 | $start = 0; |
||
58 | } |
||
59 | $fp = fopen(XOOPS_CACHE_PATH . '/' . $xoopsModule->getVar('dirname') . '_update.php', 'w'); |
||
60 | if (!$fp) { |
||
61 | return; |
||
62 | } |
||
63 | fwrite($fp, "<?php\n \$start=" . (int)$start . ";\n?>"); |
||
64 | fclose($fp); |
||
65 |
If you suppress an error, we recommend checking for the error condition explicitly: