Beispiel #1
0
function installBots15()
{
    $database =& JFactory::getDBO();
    $error = '';
    $return = '<b>' . _ACA_INSTALL_BOT . '</b> : ';
    if (!is_dir(ACA_JPATH_ROOT . '/plugins/acajoom')) {
        if (!@mkdir(ACA_JPATH_ROOT . '/plugins/acajoom', 0755)) {
            $return .= '<br /> Error adding bot directory.';
        } else {
            @chmod(ACA_JPATH_ROOT . '/plugins/acajoom', 0755);
        }
    }
    $bot_files = array('acajoombot.php', 'acajoombot.xml', 'index.html');
    foreach ($bot_files as $bot_file) {
        if (is_file(ACA_JPATH_ROOT . '/plugins/acajoom/' . $bot_file)) {
            @unlink(WPATH_ADMIN . 'bots15/' . $bot_file);
        } else {
            if (!@rename(WPATH_ADMIN . 'bots15/' . $bot_file, ACA_JPATH_ROOT . '/plugins/acajoom/' . $bot_file)) {
                $error .= '<br />Error copying bot file ' . $bot_file . ' to bot directory.';
            }
        }
    }
    @chmod(ACA_JPATH_ROOT . '/plugins/acajoom', 0755);
    if (!@rmdir(WPATH_ADMIN . 'bots15/')) {
        $error .= '<br /> Error deleting the temporary bot directory.';
    }
    ### Acajoom bot
    $bot_infos = array('Acajoom Content Bot', 'acajoombot');
    foreach ($bot_infos as $bot_info) {
        $query = "SELECT `id` FROM `#__plugins` WHERE `element` = 'acajoombot'";
        $database->setQuery($query);
        $database->query();
        $errorDB = $database->getErrorMsg();
        if (!empty($errorDB)) {
            $error .= '<br /> Error getting bot information from bot table for "' . $bot_info[0] . '". Database error: <br />' . $errorDB . '<br />';
        } else {
            $id = $database->loadResult();
            if (!$id) {
                JLoader::register('JTablePlugin', JPATH_LIBRARIES . DS . 'joomla' . DS . 'database' . DS . 'table' . DS . 'plugin.php');
                $row = new JTablePlugin($database);
                $row->name = $bot_infos[0];
                $row->ordering = 0;
                $row->folder = 'acajoom';
                $row->iscore = 0;
                $row->access = 0;
                $row->client_id = 0;
                $row->element = $bot_infos[1];
                $row->published = 1;
                if (!$row->store()) {
                    $error .= '<br />Error adding bot information to bot table for "' . $bot_info[0] . '".';
                }
            }
        }
    }
    if (empty($error)) {
        $return .= acajoom::printM('green', _ACA_INSTALL_SUCCESS) . '<br />';
    } else {
        $return .= $error . acajoom::printM('red', _ACA_INSTALL_ERROR) . '<br />';
    }
    return $return;
}
Beispiel #2
0
 function mosMambot(&$db)
 {
     parent::__construct($db);
 }