Ejemplo n.º 1
0
    ?>
"><?php 
    _e('Visit Web site', 'rmcommon');
    ?>
</a>
			</span>
					</td>
					<td>
						<span class="descriptions"><?php 
    echo $plugin->get_info('description');
    ?>
</span>
					</td>
					<td align="center">
						<strong><?php 
    echo RMFormat::version($plugin->get_info('version'));
    ?>
</strong>
					</td>
					<td align="center">
						<?php 
    if ($plugin->get_info('web') != '') {
        ?>
							<strong><a href="<?php 
        echo $plugin->get_info('web');
        ?>
"><?php 
        echo $plugin->get_info('author');
        ?>
</a></strong>
						<?php 
Ejemplo n.º 2
0
function rmc_available_mods()
{
    global $available_mods, $xoopsSecurity;
    $ret['title'] = __('Available Modules', 'rmcommon');
    $ret['icon'] = RMCURL . '/images/modules.png';
    $limit = 7;
    $tpages = ceil(count($available_mods) / $limit);
    $nav = new RMPageNav(count($available_mods), $limit, 1, 3);
    $nav->target_url('#" onclick="load_page({PAGE_NUM});');
    ob_start();
    $i = 0;
    ?>
	<div class="rmc_widget_content_reduced rmc-modules-widget">
        <img id="img-load" src="images/loading.gif" style="display: none; margin: 15px auto;" />
        <div id="mods-widget-container">
            <ul class="list-unstyled">
                <?php 
    foreach ($available_mods as $mod) {
        ?>
                <?php 
        if ($i == $limit) {
            break;
        }
        ?>
                    <li>
                        <div class="the-logo">
                            <?php 
        if ($mod->getInfo('url') != '') {
            ?>
                            <a href="modules.php?action=install&amp;dir=<?php 
            echo $mod->getInfo('dirname');
            ?>
">
                                <img src="<?php 
            echo XOOPS_URL;
            ?>
/modules/<?php 
            echo $mod->getInfo('dirname');
            ?>
/<?php 
            echo $mod->getInfo('image');
            ?>
" alt="<?php 
            echo $mod->getInfo('dirname');
            ?>
">
                            </a>
                            <?php 
        } else {
            ?>
                                <img src="<?php 
            echo XOOPS_URL;
            ?>
/modules/<?php 
            echo $mod->getInfo('dirname');
            ?>
/<?php 
            echo $mod->getInfo('image');
            ?>
" alt="<?php 
            echo $mod->getInfo('dirname');
            ?>
">
                            <?php 
        }
        ?>
                        </div>
                        <div class="the-info">
                            <ul>
                                <li class="name">
                                    <strong><a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
"><?php 
        echo $mod->getInfo('name');
        ?>
</a></strong>
                                    <small><?php 
        echo $mod->getInfo('rmversion') ? RMFormat::version($mod->getInfo('rmversion')) : $mod->getInfo('version');
        ?>
</small>
                                </li>
                                <li class="install">
                                    <a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
">
                                        <span class="fa fa-cog"></span> <span class="hidden-md"><?php 
        _e('Install', 'rmcommon');
        ?>
</span>
                                    </a>
                                </li>
                                <li class="info">
                                    <a href="javascript:;" onclick="show_module_info('<?php 
        echo $mod->getInfo('dirname');
        ?>
');">
                                        <span class="fa fa-info-circle"></span>
                                        <span class="hidden-md"><?php 
        _e('Info', 'rmcommon');
        ?>
</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                        <div class="rmc_mod_info" id="mod-<?php 
        echo $mod->getInfo('dirname');
        ?>
">
                            <div class="header">
                                <div class="logo">
                                    <img src="<?php 
        echo XOOPS_URL;
        ?>
/modules/<?php 
        echo $mod->getInfo('dirname');
        ?>
/<?php 
        echo $mod->getInfo('image');
        ?>
" alt="<?php 
        echo $mod->getInfo('dirname');
        ?>
">
                                </div>
                                <div class="name">
                                    <h4><?php 
        echo $mod->getInfo('name');
        ?>
</h4>
                                    <span class="help-block">
                                        <?php 
        echo $mod->getInfo('description');
        ?>
                                    </span>
                                </div>
                            </div>
                            <table class="table">
                                <tr>
                                    <td><?php 
        _e('Version:', 'rmcommon');
        ?>
</td>
                                    <td>
                                        <?php 
        if ($mod->getInfo('rmnative')) {
            ?>
                                            <strong><?php 
            echo RMModules::format_module_version($mod->getInfo('rmversion'));
            ?>
</strong>
                                        <?php 
        } else {
            ?>
                                            <strong><?php 
            echo $mod->getInfo('version');
            ?>
</strong>
                                        <?php 
        }
        ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <?php 
        _e('Author:', 'rmcommon');
        ?>
                                    </td>
                                    <td>
                                        <strong><?php 
        echo strip_tags($mod->getInfo('author'));
        ?>
</strong>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <?php 
        _e('Web site:', 'rmcommon');
        ?>
                                    </td>
                                    <td>
                                        <a target="_blank" href="<?php 
        echo $mod->getInfo('authorurl');
        ?>
"><?php 
        echo $mod->getInfo('authorweb');
        ?>
</a>
                                    </td>
                                </tr>
                                <tr>
                                    <td><?php 
        _e('Updatable:', 'rmcommon');
        ?>
</td>
                                    <td>
                                        <?php 
        if ($mod->getInfo('updateurl') != '') {
            ?>
                                            <span class="fa fa-check"></span>
                                        <?php 
        } else {
            ?>
                                            <span class="fa fa-times text-danger"></span>
                                        <?php 
        }
        ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td><?php 
        _e('License:', 'rmcommon');
        ?>
</td>
                                    <td>
                                        <?php 
        echo $mod->getInfo('license');
        ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td><?php 
        _e('XOOPS Official:', 'rmcommon');
        ?>
</td>
                                    <td>
                                        <?php 
        if ($mod->getInfo('official')) {
            ?>
                                            <span class="fa fa-check"></span>
                                        <?php 
        } else {
            ?>
                                            <span class="fa fa-times text-danger"></span>
                                        <?php 
        }
        ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td><?php 
        _e('C.U. Native:', 'rmcommon');
        ?>
</td>
                                    <td>
                                        <?php 
        if ($mod->getInfo('rmnative')) {
            ?>
                                            <span class="fa fa-check"></span>
                                        <?php 
        } else {
            ?>
                                            <span class="fa fa-times text-danger"></span>
                                        <?php 
        }
        ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td><?php 
        _e('Directory:', 'rmcommon');
        ?>
</td>
                                    <td>
                                        <strong><?php 
        echo $mod->getInfo('dirname');
        ?>
</strong>
                                    </td>
                                </tr>
                                <tr>
                                    <td><?php 
        _e('Released:', 'rmcommon');
        ?>
</td>
                                    <td>
                                        <?php 
        if ($mod->getInfo('releasedate') != '') {
            ?>
                                            <?php 
            $time = strtotime($mod->getInfo('releasedate'));
            echo formatTimestamp($time, 's');
            ?>
                                        <?php 
        }
        ?>
                                    </td>
                                </tr>
                                <?php 
        if ($mod->getInfo('help') != '' && $mod->getInfo('rmnative')) {
            ?>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>
                                            <strong><a href="<?php 
            echo $mod->getInfo('help');
            ?>
" target="_blank"><?php 
            _e('Get Help', 'rmcommon');
            ?>
</a></strong>
                                        </td>
                                    </tr>
                                <?php 
        }
        ?>
                                <tr>
                                    <td colspan="2" class="contact-options text-center">
                                        <?php 
        if ($mod->getInfo('authormail')) {
            ?>
                                            <?php 
            if ($mod->getInfo('authormail') != '') {
                ?>
                                                <a target="_blank" href="mailto:<?php 
                echo $mod->getInfo('authormail');
                ?>
"><span class="fa fa-envelope"></span></a>
                                            <?php 
            }
            ?>
                                        <?php 
        }
        ?>
                                        <?php 
        if ($mod->getInfo('social')) {
            ?>
                                        <?php 
            foreach ($mod->getInfo('social') as $social) {
                ?>
                                            <a target="_blank" href="<?php 
                echo $social['url'];
                ?>
"><span class="<?php 
                echo parse_social_icons($social['type']);
                ?>
"></span></a>
                                        <?php 
            }
            ?>
                                        <?php 
        }
        ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" class="text-center">
                                        <a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
" class="btn btn-success btn-sm"><?php 
        _e('Install', 'rmcommon');
        ?>
</a>
                                        <a href="#" onclick="closeInfo();" class="btn btn-warning btn-sm"><?php 
        _e('Close', 'rmcommon');
        ?>
</a>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </li>
                    <?php 
        $i++;
    }
    ?>
            </ul>
        <?php 
    $nav->display(false);
    ?>
            <input type="hidden" id="token" value="<?php 
    echo $xoopsSecurity->createToken();
    ?>
" />
        </div>
	</div>
<?php 
    $ret['content'] = ob_get_clean();
    return $ret;
    //print_r($available_mods);
}
Ejemplo n.º 3
0
 /**
  * Format bytes to MB, GB, KB, etc
  * @param int $size Tamaño de bytes
  * @return string
  */
 public function formatBytesSize($size)
 {
     return RMFormat::bytes_format($size, 'bytes');
 }
Ejemplo n.º 4
0
 /**
  * Format a given array with version information for a module.
  *
  * @param  array  $version Array with version values
  * @param  bool   $name    Include module name in return string
  * @return string
  */
 public static function format_module_version($version, $name = false)
 {
     return RMFormat::version($version, $name);
 }
Ejemplo n.º 5
0
    }
    $image = new RMImage($id);
    if ($image->isNew()) {
        images_send_json(array('message' => __('Specified image does not exists', 'rmcommon'), 'error' => 1, 'token' => $xoopsSecurity->createToken()));
    }
    $author = new RMUser($image->uid);
    $original = pathinfo($image->get_files_path() . '/' . $image->file);
    $dimensions = getimagesize($image->get_files_path() . '/' . $image->file);
    $mimes = (include XOOPS_ROOT_PATH . '/include/mimetypes.inc.php');
    $category_sizes = $cat->getVar('sizes');
    $sizes = array();
    foreach ($category_sizes as $i => $size) {
        if ($size['width'] <= 0) {
            continue;
        }
        $tfile = $image->get_files_path() . '/sizes/' . $original['filename'] . '-' . $size['name'] . '.' . $original['extension'];
        if (!is_file($tfile)) {
            continue;
        }
        $t_dim = getimagesize($tfile);
        $sizes[] = array('width' => $t_dim[0], 'height' => $t_dim[1], 'url' => $image->get_files_url() . '/sizes/' . $original['filename'] . '-' . $size['name'] . '.' . $original['extension'], 'name' => $size['name']);
    }
    $sizes[] = array('width' => $dimensions[0], 'height' => $dimensions[1], 'url' => $image->getOriginal(), 'name' => __('Original', 'rmcommon'));
    $links = array('none' => array('caption' => __('None', 'rmcommon'), 'value' => ''), 'file' => array('caption' => __('File URL', 'rmcommon'), 'value' => XOOPS_UPLOAD_URL . '/' . date('Y', $image->getVar('date')) . '/' . date('m', $image->getVar('date')) . '/' . $image->getVar('file')));
    $links = RMEvents::get()->run_event('rmcommon.image.insert.links', $links, $image, RMHttpRequest::post('url', 'string', ''));
    // Image data
    $data = array('id' => $image->id(), 'title' => $image->title, 'date' => formatTimestamp($image->date, 'l'), 'description' => $image->getVar('desc', 'n'), 'author' => array('uname' => $author->uname, 'uid' => $author->uid, 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $author->email, 40), 'url' => XOOPS_URL . '/userinfo.php?uid=' . $author->email), 'medium' => $image->get_by_size(300), 'url' => $image->get_files_url(), 'original' => array('file' => $original['basename'], 'url' => $image->getOriginal(), 'size' => RMFormat::bytes_format(filesize($image->get_files_path() . '/' . $image->file)), 'width' => $dimensions[0], 'height' => $dimensions[1]), 'mime' => isset($mimes[$original['extension']]) ? $mimes[$original['extension']] : 'application/octet-stream', 'sizes' => $sizes, 'links' => $links);
    $data = RMEvents::get()->run_event('rmcommon.loading.image.details', $data, $image, RMHttpRequest::request('url', 'string', ''));
    $data['token'] = $xoopsSecurity->createToken();
    images_send_json($data);
}
Ejemplo n.º 6
0
function load_modules_page()
{
    global $xoopsLogger, $xoopsSecurity;
    error_reporting(0);
    $xoopsLogger->activated = false;
    if (!$xoopsSecurity->check(true, rmc_server_var($_POST, 'token', ''))) {
        echo __("Sorry, you don't have access to this page", 'rmcommon');
        echo "<br /><a href='javascript:;' onclick='location.reload();'>" . __('Click here to refresh', 'rmcommon') . "</a>";
        die;
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("modules") . " ORDER BY `name`";
    $result = $db->query($sql);
    $installed_dirs = array();
    while ($row = $db->fetchArray($result)) {
        $installed_dirs[] = $row['dirname'];
    }
    require_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
    $dirlist = XoopsLists::getModulesList();
    $available_mods = array();
    $module_handler = xoops_gethandler('module');
    foreach ($dirlist as $file) {
        clearstatcache();
        $file = trim($file);
        if (!in_array($file, $installed_dirs)) {
            $module =& $module_handler->create();
            if (!$module->loadInfo($file, false)) {
                continue;
            }
            $available_mods[] = $module;
            unset($module);
        }
    }
    unset($dirlist);
    unset($module_handler);
    $limit = 7;
    $tpages = ceil(count($available_mods) / $limit);
    $page = rmc_server_var($_POST, 'page', 1);
    if ($page > $tpages) {
        $page = 1;
    }
    $start = ($page <= 0 ? 0 : $page - 1) * $limit;
    $nav = new RMPageNav(count($available_mods), $limit, $page, 3);
    $nav->target_url('javascript:;" onclick="load_page({PAGE_NUM});');
    // Event for available modules
    $available_mods = RMEvents::get()->run_event('rmcommon.available.modules', $available_mods);
    $end = $page * $limit;
    if ($end > count($available_mods)) {
        $end = count($available_mods);
    }
    ob_start();
    ?>
    <ul class="list-unstyled">
        <?php 
    for ($i = $start; $i < $end; $i++) {
        ?>
        <?php 
        $mod = $available_mods[$i];
        ?>
            <li>
                <div class="the-logo">
                    <?php 
        if ($mod->getInfo('url') != '') {
            ?>
                        <a href="modules.php?action=install&amp;dir=<?php 
            echo $mod->getInfo('dirname');
            ?>
">
                            <img src="<?php 
            echo XOOPS_URL;
            ?>
/modules/<?php 
            echo $mod->getInfo('dirname');
            ?>
/<?php 
            echo $mod->getInfo('image');
            ?>
" alt="<?php 
            echo $mod->getInfo('dirname');
            ?>
">
                        </a>
                    <?php 
        } else {
            ?>
                        <img src="<?php 
            echo XOOPS_URL;
            ?>
/modules/<?php 
            echo $mod->getInfo('dirname');
            ?>
/<?php 
            echo $mod->getInfo('image');
            ?>
" alt="<?php 
            echo $mod->getInfo('dirname');
            ?>
">
                    <?php 
        }
        ?>
                </div>
                <div class="the-info">
                    <ul>
                        <li class="name">
                            <strong><a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
"><?php 
        echo $mod->getInfo('name');
        ?>
</a></strong>
                            <small><?php 
        echo $mod->getInfo('rmversion') ? RMFormat::version($mod->getInfo('rmversion')) : $mod->getInfo('version');
        ?>
</small>
                        </li>
                        <li class="install">
                            <a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
">
                                <span class="fa fa-cog"></span> <?php 
        _e('Install', 'rmcommon');
        ?>
                            </a>
                        </li>
                        <li class="info">
                            <a href="javascript:;" onclick="show_module_info('<?php 
        echo $mod->getInfo('dirname');
        ?>
');">
                                <span class="fa fa-info-circle"></span>
                                <?php 
        _e('Info', 'rmcommon');
        ?>
                            </a>
                        </li>
                    </ul>
                </div>
                <div class="rmc_mod_info" id="mod-<?php 
        echo $mod->getInfo('dirname');
        ?>
">
                    <div class="header">
                        <div class="logo">
                            <img src="<?php 
        echo XOOPS_URL;
        ?>
/modules/<?php 
        echo $mod->getInfo('dirname');
        ?>
/<?php 
        echo $mod->getInfo('image');
        ?>
" alt="<?php 
        echo $mod->getInfo('dirname');
        ?>
">
                        </div>
                        <div class="name">
                            <h4><?php 
        echo $mod->getInfo('name');
        ?>
</h4>
                                    <span class="help-block">
                                        <?php 
        echo $mod->getInfo('description');
        ?>
                                    </span>
                        </div>
                    </div>
                    <table class="table">
                        <tr>
                            <td><?php 
        _e('Version:', 'rmcommon');
        ?>
</td>
                            <td>
                                <?php 
        if ($mod->getInfo('rmnative')) {
            ?>
                                    <strong><?php 
            echo RMModules::format_module_version($mod->getInfo('rmversion'));
            ?>
</strong>
                                <?php 
        } else {
            ?>
                                    <strong><?php 
            echo $mod->getInfo('version');
            ?>
</strong>
                                <?php 
        }
        ?>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php 
        _e('Author:', 'rmcommon');
        ?>
                            </td>
                            <td>
                                <strong><?php 
        echo strip_tags($mod->getInfo('author'));
        ?>
</strong>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php 
        _e('Web site:', 'rmcommon');
        ?>
                            </td>
                            <td>
                                <a target="_blank" href="<?php 
        echo $mod->getInfo('authorurl');
        ?>
"><?php 
        echo $mod->getInfo('authorweb');
        ?>
</a>
                            </td>
                        </tr>
                        <tr>
                            <td><?php 
        _e('Updatable:', 'rmcommon');
        ?>
</td>
                            <td>
                                <?php 
        if ($mod->getInfo('updateurl') != '') {
            ?>
                                    <span class="fa fa-check"></span>
                                <?php 
        } else {
            ?>
                                    <span class="fa fa-times text-danger"></span>
                                <?php 
        }
        ?>
                            </td>
                        </tr>
                        <tr>
                            <td><?php 
        _e('License:', 'rmcommon');
        ?>
</td>
                            <td>
                                <?php 
        echo $mod->getInfo('license');
        ?>
                            </td>
                        </tr>
                        <tr>
                            <td><?php 
        _e('XOOPS Official:', 'rmcommon');
        ?>
</td>
                            <td>
                                <?php 
        if ($mod->getInfo('official')) {
            ?>
                                    <span class="fa fa-check"></span>
                                <?php 
        } else {
            ?>
                                    <span class="fa fa-times text-danger"></span>
                                <?php 
        }
        ?>
                            </td>
                        </tr>
                        <tr>
                            <td><?php 
        _e('C.U. Native:', 'rmcommon');
        ?>
</td>
                            <td>
                                <?php 
        if ($mod->getInfo('rmnative')) {
            ?>
                                    <span class="fa fa-check"></span>
                                <?php 
        } else {
            ?>
                                    <span class="fa fa-times text-danger"></span>
                                <?php 
        }
        ?>
                            </td>
                        </tr>
                        <tr>
                            <td><?php 
        _e('Directory:', 'rmcommon');
        ?>
</td>
                            <td>
                                <strong><?php 
        echo $mod->getInfo('dirname');
        ?>
</strong>
                            </td>
                        </tr>
                        <tr>
                            <td><?php 
        _e('Released:', 'rmcommon');
        ?>
</td>
                            <td>
                                <?php 
        if ($mod->getInfo('releasedate') != '') {
            ?>
                                    <?php 
            $time = strtotime($mod->getInfo('releasedate'));
            echo formatTimestamp($time, 's');
            ?>
                                <?php 
        }
        ?>
                            </td>
                        </tr>
                        <?php 
        if ($mod->getInfo('help') != '' && $mod->getInfo('rmnative')) {
            ?>
                            <tr>
                                <td>&nbsp;</td>
                                <td>
                                    <strong><a href="<?php 
            echo $mod->getInfo('help');
            ?>
" target="_blank"><?php 
            _e('Get Help', 'rmcommon');
            ?>
</a></strong>
                                </td>
                            </tr>
                        <?php 
        }
        ?>
                        <tr>
                            <td colspan="2" class="contact-options text-center">
                                <?php 
        if ($mod->getInfo('authormail')) {
            ?>
                                    <?php 
            if ($mod->getInfo('authormail') != '') {
                ?>
                                        <a target="_blank" href="mailto:<?php 
                echo $mod->getInfo('authormail');
                ?>
"><span class="fa fa-envelope"></span></a>
                                    <?php 
            }
            ?>
                                <?php 
        }
        ?>
                                <?php 
        if ($mod->getInfo('social')) {
            ?>
                                    <?php 
            foreach ($mod->getInfo('social') as $social) {
                ?>
                                        <a target="_blank" href="<?php 
                echo $social['url'];
                ?>
"><span class="fa fa-<?php 
                echo $social['type'];
                ?>
-square"></span></a>
                                    <?php 
            }
            ?>
                                <?php 
        }
        ?>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" class="text-center">
                                <a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
" class="btn btn-success btn-sm"><?php 
        _e('Install', 'rmcommon');
        ?>
</a>
                                <a href="#" onclick="closeInfo();" class="btn btn-warning btn-sm"><?php 
        _e('Close', 'rmcommon');
        ?>
</a>
                            </td>
                        </tr>
                    </table>
                </div>
            </li>
        <?php 
    }
    ?>
    </ul>
    <?php 
    $nav->display(false);
    ?>
    <input type="hidden" id="token" value="<?php 
    echo $xoopsSecurity->createToken();
    ?>
" />
<?php 
    $ret = ob_get_clean();
    echo $ret;
}