mambax7 /
planet
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: http://xoops.org // |
||
| 25 | // Project: Article Project // |
||
| 26 | // ------------------------------------------------------------------------ // |
||
| 27 | |||
| 28 | include __DIR__ . '/header.php'; |
||
| 29 | |||
| 30 | $blog_id = (int)(!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0)); |
||
| 31 | $blog_handler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
||
| 32 | if ($blog_id > 0) { |
||
| 33 | $blog =& $blog_handler->get($blog_id); |
||
| 34 | $count = $blog_handler->do_update($blog); |
||
| 35 | redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php?blog=' . $blog_id, 2, |
||
| 36 | sprintf(planet_constant('MD_UPDATED'), (int)$count)); |
||
| 37 | } |
||
| 38 | if (planet_getcookie('upd') + 30 * 60 > time()) { |
||
| 39 | return; |
||
| 40 | } |
||
| 41 | planet_setcookie('upd', time()); |
||
| 42 | $start = 0; |
||
| 43 | @include XOOPS_CACHE_PATH . '/' . $xoopsModule->getVar('dirname') . '_update.php'; |
||
|
0 ignored issues
–
show
|
|||
| 44 | $criteria = new Criteria('blog_status', 0, '>'); |
||
| 45 | $criteria->setSort('blog_id'); |
||
| 46 | $criteria->setStart($start); |
||
| 47 | $criteria->setLimit($xoopsModuleConfig['blogs_perupdate']); |
||
| 48 | $blogs = $blog_handler->getAll($criteria); |
||
| 49 | foreach (array_keys($blogs) as $id) { |
||
| 50 | $blog_handler->do_update($blogs[$id]); |
||
| 51 | } |
||
| 52 | $start += count($blogs); |
||
| 53 | if (count($blogs) < $xoopsModuleConfig['blogs_perupdate']) { |
||
| 54 | $start = 0; |
||
| 55 | } |
||
| 56 | $fp = fopen(XOOPS_CACHE_PATH . '/' . $xoopsModule->getVar('dirname') . '_update.php', 'w'); |
||
| 57 | if (!$fp) { |
||
| 58 | return; |
||
| 59 | } |
||
| 60 | fwrite($fp, "<?php\n \$start=" . (int)$start . ";\n?>"); |
||
| 61 | fclose($fp); |
||
| 62 |
If you suppress an error, we recommend checking for the error condition explicitly: