Example #1
0
function userman_configpageinit($pagename)
{
    global $currentcomponent;
    global $amp_conf;
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
    $extension = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : null;
    $tech_hardware = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null;
    if (version_compare_freepbx(getVersion(), '12.0', '<') && $pagename == 'userman') {
        $userman = setup_userman();
        $userman->doConfigPageInit($_REQUEST['display']);
    }
    // We only want to hook 'users' or 'extensions' pages.
    if ($pagename != 'users' && $pagename != 'extensions') {
        return true;
    }
    //$currentcomponent->addprocessfunc('userman_configprocess', 1);
    if ($tech_hardware != null || $extdisplay != '' || $pagename == 'users' || $action == 'add') {
        // On a 'new' user, 'tech_hardware' is set, and there's no extension. Hook into the page.
        if ($tech_hardware != null) {
            userman_applyhooks();
        } elseif ($action == 'add') {
            $currentcomponent->addprocessfunc('userman_configprocess', 1);
        } elseif ($extdisplay != '' || $pagename == 'users') {
            // We're now viewing an extension, so we need to display _and_ process.
            userman_applyhooks();
            $currentcomponent->addprocessfunc('userman_configprocess', 1);
        }
    }
}
Example #2
0
 public static function checkAllUpdate($_filter = '', $_findNewObject = true)
 {
     $findCore = false;
     $marketObject = array('logical_id' => array(), 'version' => array());
     if ($_findNewObject) {
         self::findNewUpdateObject();
     }
     $updates = self::all($_filter);
     if (is_array($updates)) {
         foreach (self::all($_filter) as $update) {
             if ($update->getType() == 'core') {
                 if ($findCore) {
                     $update->remove();
                     continue;
                 }
                 $findCore = true;
                 $update->setType('core');
                 $update->setLogicalId('jeedom');
                 if (method_exists('jeedom', 'version')) {
                     $update->setLocalVersion(jeedom::version());
                 } else {
                     $update->setLocalVersion(getVersion('jeedom'));
                 }
                 $update->save();
                 $update->checkUpdate();
             } else {
                 if ($update->getStatus() != 'hold') {
                     $marketObject['logical_id'][] = array('logicalId' => $update->getLogicalId(), 'type' => $update->getType());
                     $marketObject['version'][] = $update->getConfiguration('version', 'stable');
                     $marketObject[$update->getType() . $update->getLogicalId()] = $update;
                 }
             }
         }
     }
     if (!$findCore) {
         $update = new update();
         $update->setType('core');
         $update->setLogicalId('jeedom');
         if (method_exists('jeedom', 'version')) {
             $update->setLocalVersion(jeedom::version());
         } else {
             $update->setLocalVersion(getVersion('jeedom'));
         }
         $update->save();
         $update->checkUpdate();
     }
     $markets_infos = market::getInfo($marketObject['logical_id'], $marketObject['version']);
     foreach ($markets_infos as $logicalId => $market_info) {
         $update = $marketObject[$logicalId];
         if (is_object($update)) {
             $update->setStatus($market_info['status']);
             $update->setConfiguration('market_owner', $market_info['market_owner']);
             $update->setConfiguration('market', $market_info['market']);
             $update->setRemoteVersion($market_info['datetime']);
             $update->save();
         }
     }
     config::save('update::lastCheck', date('Y-m-d H:i:s'));
 }
Example #3
0
 /**
  * startup
  */
 public function startup()
 {
     $this->clear();
     $this->out("<info>Welcome to baserCMS v" . getVersion() . " Console</info>");
     $this->hr();
     $this->out('App : ' . APP_DIR);
     $this->out('Path: ' . APP);
     $this->hr();
 }
function com_install()
{
    $db =& JFactory::getDBO();
    $ver = getVersion();
    $error = false;
    $sqlDir = JPATH_ADMINISTRATOR . DS . "components" . DS . "com_webmapplus" . DS . "install" . DS;
    $sql = "";
    if ($ver == false) {
        echo "Installing clean database...";
        $sql .= file_get_contents($sqlDir . "install.sql");
    } elseif ($ver[1] == 5 || $ver[1] == 2 && $ver[2] == 5) {
        echo "N/A.<br />";
        return true;
        //Short circuit because we are already at latest version
    } else {
        echo "Upgrade Database from version " . implode('.', $ver) . "...";
        $sqlDir .= "upgrade" . DS;
        switch ($ver[1]) {
            case 0:
                $sql .= file_get_contents($sqlDir . "1.0-1.1.0-upgrade.sql");
            case 1:
                if ($ver[2] == 0 || $ver[1] == 0) {
                    $sql .= file_get_contents($sqlDir . "1.1-1.1.3-upgrade.sql");
                    $sql .= file_get_contents($sqlDir . "1.1-1.2.0-upgrade.sql");
                }
            case 2:
                if ($ver[2] >= 5) {
                } elseif ($ver[2] != 4 && $ver[2] >= 1) {
                    $sql .= file_get_contents($sqlDir . "1.2.1-1.2.4-upgrade.sql");
                } elseif ($ver[2] == 0) {
                    $sql .= file_get_contents($sqlDir . "1.2.0-1.2.1-upgrade.sql");
                    $sql .= file_get_contents($sqlDir . "1.2.1-1.2.4-upgrade.sql");
                }
                break;
        }
        $sql .= file_get_contents($sqlDir . "1.2.4-1.2.5-upgrade.sql");
    }
    $sql = preg_replace('#/\\*(.*?)\\*/#sm', '', $sql);
    $sql = $db->splitSql($sql);
    foreach ($sql as $stmt) {
        $stmt = trim($stmt);
        if ($stmt != "" && $stmt[0] != "#" && substr($stmt, 0, 2) != "--") {
            $db->setQuery($stmt);
            $result = $db->query();
            if (!$result) {
                echo "<br />" . JText::_("Install Error") . ": " . $db->ErrorMsg() . "<br />";
                $error = true;
            }
        }
    }
    echo "Done!<br /> Executed " . count($sql) . " SQL statements. <br />";
    return !$error;
}
Example #5
0
function step1()
{
    $options = array('http' => array('user_agent' => $_SERVER['HTTP_USER_AGENT']));
    $context = stream_context_create($options);
    $branches = json_decode(file_get_contents('https://api.github.com/repos/Team-Quantum/QuantumCMS/branches', false, $context));
    echo '<b>Please select the branch you want to install:</b><br /><br />';
    echo '<form method="get">';
    echo '<select name="branch">';
    foreach ($branches as $branch) {
        echo '<option value="' . $branch->name . '">' . $branch->name . ' (' . getVersion($branch->commit->sha) . ')' . '</option>';
    }
    echo '</select><br /><br />';
    echo '<input type="hidden" name="step" value="2" />';
    echo '<input class="btn btn-default" type="submit" value="Download" />';
    echo '</form>';
}
Example #6
0
 /**
  * Constructor
  *
  * Initializes the boundary strings and part counters
  */
 public function __construct()
 {
     global $conf;
     $server = parse_url(DOKU_URL, PHP_URL_HOST);
     $this->partid = md5(uniqid(rand(), true)) . '@' . $server;
     $this->boundary = '----------' . md5(uniqid(rand(), true));
     $listid = join('.', array_reverse(explode('/', DOKU_BASE))) . $server;
     $listid = strtolower(trim($listid, '.'));
     $this->allowhtml = (bool) $conf['htmlmail'];
     // add some default headers for mailfiltering FS#2247
     $this->setHeader('X-Mailer', 'DokuWiki ' . getVersion());
     $this->setHeader('X-DokuWiki-User', $_SERVER['REMOTE_USER']);
     $this->setHeader('X-DokuWiki-Title', $conf['title']);
     $this->setHeader('X-DokuWiki-Server', $server);
     $this->setHeader('X-Auto-Response-Suppress', 'OOF');
     $this->setHeader('List-Id', $conf['title'] . ' <' . $listid . '>');
 }
Example #7
0
 /**
  * Create output
  */
 function render($format, &$renderer, $data)
 {
     if ($format == 'xhtml') {
         //handle various info stuff
         switch ($data[0]) {
             case 'version':
                 $renderer->doc .= getVersion();
                 break;
             case 'syntaxmodes':
                 $renderer->doc .= $this->_syntaxmodes_xhtml();
                 break;
             case 'syntaxtypes':
                 $renderer->doc .= $this->_syntaxtypes_xhtml();
                 break;
             case 'syntaxplugins':
                 $this->_plugins_xhtml('syntax', $renderer);
                 break;
             case 'adminplugins':
                 $this->_plugins_xhtml('admin', $renderer);
                 break;
             case 'actionplugins':
                 $this->_plugins_xhtml('action', $renderer);
                 break;
             case 'rendererplugins':
                 $this->_plugins_xhtml('renderer', $renderer);
                 break;
             case 'helperplugins':
                 $this->_plugins_xhtml('helper', $renderer);
                 break;
             case 'helpermethods':
                 $this->_helpermethods_xhtml($renderer);
                 break;
             default:
                 $renderer->doc .= "no info about " . htmlspecialchars($data[0]);
         }
         return true;
     }
     return false;
 }
function getURL($type, $version = 0)
{
    global $siteId, $token;
    $monthAgo = date('Y-m-d', strtotime('-1 month'));
    switch ($type) {
        case 'installs':
            return 'http://stats.getnightingale.com/?module=API&method=VisitsSummary.getUniqueVisitors&idSite=' . $siteId . '&language=' . $lang . '&token_auth=' . $token . '&period=day&date=' . $monthAgo . ',today&format=JSON&segment=customVariableValue1==install';
        case 'downloads':
            return 'http://stats.getnightingale.com/?module=API&method=VisitsSummary.getVisits&idSite=2&language=' . $lang . '&token_auth=' . $token . '&period=day&date=' . $monthAgo . ',today&format=JSON&segment=visitConvertedGoalId==1';
        case 'infiniteInstalls':
            return 'http://stats.getnightingale.com/?module=API&method=VisitsSummary.getUniqueVisitors&idSite=' . $siteId . '&language=' . $lang . '&token_auth=' . $token . '&period=day&date=2014-01-12,today&format=JSON&segment=customVariableValue1==install;customVariableValue2==' . $version;
        case 'updates':
            return 'http://stats.getnightingale.com/?module=API&method=VisitsSummary.getUniqueVisitors&idSite=' . $siteId . '&language=' . $lang . '&token_auth=' . $token . '&period=day&date=' . $monthAgo . ',today&format=JSON&segment=customVariableValue1==upgrade';
        case 'infiniteUpdates':
            return 'http://stats.getnightingale.com/?module=API&method=VisitsSummary.getUniqueVisitors&idSite=' . $siteId . '&language=' . $lang . '&token_auth=' . $token . '&period=day&date=2014-01-12,today&format=JSON&segment=customVariableValue1==upgrade;customVariableValue2==' . $version;
        case 'versionGraph':
            return 'http://stats.getnightingale.com/?module=API&method=CustomVariables.getCustomVariables&idSite=' . $siteId . '&language=' . $lang . '&token_auth=' . $token . '&period=day&date=' . $monthAgo . ',today&flat=1&format=JSON&filter_pattern_recursive=Version*';
        case 'osDistribution':
            return 'http://stats.getnightingale.com/?module=API&method=DevicesDetection.getOsFamilies&idSite=' . $siteId . '&language=' . $lang . '&token_auth=' . $token . '&period=range&date=2014-01-12,today&format=JSON&segment=customVariableValue2==' . getVersion();
        default:
            return '';
    }
}
Example #9
0
<?php

getHeader();
Posts::handleSiteViewsStatic();
?>
    <div align="center" class="col-xs-12 col-sm-12 col-md-2 col-lg-2 col-md-offset-1 col-lg-offset-1">
        <a class="btn btn-warning btn-lg"><i class="mdi mdi-download"></i>&nbsp;Download</a>
        <span class="help-block">v.<?php 
echo getVersion();
?>
 Alpha</span>
    </div>

    <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 col-md-offset-1 col-lg-offset-1 div_white_left">
        <article class="post">
            <a href="submit.php"><h3 align="center" style="font-weight: bold;">Submit Page</h3></a>
            <p>You have been redirected here from a submit form in our website.</p>
            <span>Please confirm that you want to complete the action.</span><br><br>
            <span>Action: <?php 
echo 'action';
?>
</span>
            <br><br>
        </article>
    </div>
<?php 
getFooter();
Example #10
0
            $pattern = $filename;
        }
    }
} else {
    $indir = INSTALLDIR;
}
function getVersion()
{
    // define('GNUSOCIAL_VERSION', '0.9.1');
    $source = file_get_contents(INSTALLDIR . '/lib/common.php');
    if (preg_match('/^\\s*define\\s*\\(\\s*[\'"]GNUSOCIAL_VERSION[\'"]\\s*,\\s*[\'"](.*)[\'"]\\s*\\)\\s*;/m', $source, $matches)) {
        return $matches[1];
    }
    return 'unknown';
}
$replacements = array('%%version%%' => getVersion(), '%%indir%%' => $indir, '%%pattern%%' => $pattern, '%%outdir%%' => $outdir, '%%htmlout%%' => $outdir, '%%exclude%%' => $exclude);
var_dump($replacements);
$template = file_get_contents(dirname(__FILE__) . '/doxygen.tmpl');
$template = strtr($template, $replacements);
$templateFile = tempnam(sys_get_temp_dir(), 'statusnet-doxygen');
file_put_contents($templateFile, $template);
$cmd = "doxygen " . escapeshellarg($templateFile);
$retval = 0;
passthru($cmd, $retval);
if ($retval == 0) {
    echo "Done!\n";
    unlink($templateFile);
    exit(0);
} else {
    echo "Failed! Doxygen config left in {$templateFile}\n";
    exit($retval);
Example #11
0
 /**
  * プラグイン情報を取得する
  *
  * @param array $datas プラグインのデータ配列
  * @param string $file プラグインファイルのパス
  * @return array
  */
 public function getPluginInfo($datas, $file)
 {
     $plugin = basename($file);
     $pluginData = array();
     $exists = false;
     foreach ($datas as $data) {
         if ($plugin == $data['Plugin']['name']) {
             $pluginData = $data;
             $exists = true;
             break;
         }
     }
     // プラグインのバージョンを取得
     $corePlugins = Configure::read('BcApp.corePlugins');
     $core = false;
     if (in_array($plugin, $corePlugins)) {
         $core = true;
         $version = getVersion();
     } else {
         $version = getVersion($plugin);
     }
     // 設定ファイル読み込み
     $title = $description = $author = $url = $adminLink = '';
     // TODO 互換性のため古いパスも対応
     $oldAppConfigPath = $file . DS . 'Config' . DS . 'config.php';
     $appConfigPath = $file . DS . 'config.php';
     if (!file_exists($appConfigPath)) {
         $appConfigPath = $oldAppConfigPath;
     }
     if (file_exists($appConfigPath)) {
         include $appConfigPath;
     } elseif (file_exists($oldAppConfigPath)) {
         include $oldAppConfigPath;
     }
     if (isset($title)) {
         $pluginData['Plugin']['title'] = $title;
     }
     if (isset($description)) {
         $pluginData['Plugin']['description'] = $description;
     }
     if (isset($author)) {
         $pluginData['Plugin']['author'] = $author;
     }
     if (isset($url)) {
         $pluginData['Plugin']['url'] = $url;
     }
     $pluginData['Plugin']['update'] = false;
     $pluginData['Plugin']['old_version'] = false;
     $pluginData['Plugin']['core'] = $core;
     if ($exists) {
         if (isset($adminLink)) {
             $pluginData['Plugin']['admin_link'] = $adminLink;
         }
         // バージョンにBaserから始まるプラグイン名が入っている場合は古いバージョン
         if (!$pluginData['Plugin']['version'] && preg_match('/^Baser[a-zA-Z]+\\s([0-9\\.]+)$/', $version, $matches)) {
             $pluginData['Plugin']['version'] = $matches[1];
             $pluginData['Plugin']['old_version'] = true;
         } elseif (verpoint($pluginData['Plugin']['version']) < verpoint($version) && !in_array($pluginData['Plugin']['name'], Configure::read('BcApp.corePlugins'))) {
             $pluginData['Plugin']['update'] = true;
         }
         $pluginData['Plugin']['registered'] = true;
     } else {
         // バージョンにBaserから始まるプラグイン名が入っている場合は古いバージョン
         if (preg_match('/^Baser[a-zA-Z]+\\s([0-9\\.]+)$/', $version, $matches)) {
             $version = $matches[1];
             $pluginData['Plugin']['old_version'] = true;
         }
         $pluginData['Plugin']['id'] = '';
         $pluginData['Plugin']['name'] = $plugin;
         $pluginData['Plugin']['created'] = '';
         $pluginData['Plugin']['version'] = $version;
         $pluginData['Plugin']['status'] = false;
         $pluginData['Plugin']['modified'] = '';
         $pluginData['Plugin']['admin_link'] = '';
         $pluginData['Plugin']['registered'] = false;
     }
     return $pluginData;
 }
Example #12
0
/**
 * List available Administration Tasks
 *
 * @author Andreas Gohr <*****@*****.**>
 * @author Håkan Sandell <*****@*****.**>
 */
function html_admin()
{
    global $ID;
    global $INFO;
    global $conf;
    /** @var DokuWiki_Auth_Plugin $auth */
    global $auth;
    // build menu of admin functions from the plugins that handle them
    $pluginlist = plugin_list('admin');
    $menu = array();
    foreach ($pluginlist as $p) {
        /** @var DokuWiki_Admin_Plugin $obj */
        if (($obj = plugin_load('admin', $p)) === null) {
            continue;
        }
        // check permissions
        if ($obj->forAdminOnly() && !$INFO['isadmin']) {
            continue;
        }
        $menu[$p] = array('plugin' => $p, 'prompt' => $obj->getMenuText($conf['lang']), 'sort' => $obj->getMenuSort());
    }
    // data security check
    // simple check if the 'savedir' is relative and accessible when appended to DOKU_URL
    // it verifies either:
    //   'savedir' has been moved elsewhere, or
    //   has protection to prevent the webserver serving files from it
    if (substr($conf['savedir'], 0, 2) == './') {
        echo '<a style="border:none; float:right;"
                href="http://www.dokuwiki.org/security#web_access_security">
                <img src="' . DOKU_URL . $conf['savedir'] . '/security.png" alt="Your data directory seems to be protected properly."
                onerror="this.parentNode.style.display=\'none\'" /></a>';
    }
    print p_locale_xhtml('admin');
    // Admin Tasks
    if ($INFO['isadmin']) {
        ptln('<ul class="admin_tasks">');
        if ($menu['usermanager'] && $auth && $auth->canDo('getUsers')) {
            ptln('  <li class="admin_usermanager"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'usermanager')) . '">' . $menu['usermanager']['prompt'] . '</a></div></li>');
        }
        unset($menu['usermanager']);
        if ($menu['acl']) {
            ptln('  <li class="admin_acl"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'acl')) . '">' . $menu['acl']['prompt'] . '</a></div></li>');
        }
        unset($menu['acl']);
        if ($menu['extension']) {
            ptln('  <li class="admin_plugin"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'extension')) . '">' . $menu['extension']['prompt'] . '</a></div></li>');
        }
        unset($menu['extension']);
        if ($menu['config']) {
            ptln('  <li class="admin_config"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'config')) . '">' . $menu['config']['prompt'] . '</a></div></li>');
        }
        unset($menu['config']);
        if ($menu['styling']) {
            ptln('  <li class="admin_styling"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'styling')) . '">' . $menu['styling']['prompt'] . '</a></div></li>');
        }
        unset($menu['styling']);
    }
    ptln('</ul>');
    // Manager Tasks
    ptln('<ul class="admin_tasks">');
    if ($menu['revert']) {
        ptln('  <li class="admin_revert"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'revert')) . '">' . $menu['revert']['prompt'] . '</a></div></li>');
    }
    unset($menu['revert']);
    if ($menu['popularity']) {
        ptln('  <li class="admin_popularity"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'popularity')) . '">' . $menu['popularity']['prompt'] . '</a></div></li>');
    }
    unset($menu['popularity']);
    // print DokuWiki version:
    ptln('</ul>');
    echo '<div id="admin__version">';
    echo getVersion();
    echo '</div>';
    // print the rest as sorted list
    if (count($menu)) {
        // sort by name, then sort
        usort($menu, function ($a, $b) {
            $strcmp = strcasecmp($a['prompt'], $b['prompt']);
            if ($strcmp != 0) {
                return $strcmp;
            }
            if ($a['sort'] == $b['sort']) {
                return 0;
            }
            return $a['sort'] < $b['sort'] ? -1 : 1;
        });
        // output the menu
        ptln('<div class="clearer"></div>');
        print p_locale_xhtml('adminplugins');
        ptln('<ul>');
        foreach ($menu as $item) {
            if (!$item['prompt']) {
                continue;
            }
            ptln('  <li><div class="li"><a href="' . wl($ID, 'do=admin&amp;page=' . $item['plugin']) . '">' . $item['prompt'] . '</a></div></li>');
        }
        ptln('</ul>');
    }
}
Example #13
0
 /**
  * Unpack the tarball
  *
  * @return bool
  */
 private function _step_unpack()
 {
     $this->_say('<b>' . $this->getLang('pk_extract') . '</b>');
     @set_time_limit(120);
     @ignore_user_abort();
     try {
         $tar = new VerboseTar();
         $tar->open($this->tgzfile);
         $tar->extract($this->tgzdir, 1);
         $tar->close();
     } catch (Exception $e) {
         $this->_warn($e->getMessage());
         $this->_warn($this->getLang('pk_fail'));
         return false;
     }
     $this->_say($this->getLang('pk_done'));
     $this->_say($this->getLang('pk_version'), hsc(file_get_contents($this->tgzdir . '/VERSION')), getVersion());
     return true;
 }
Example #14
0
            $berhasil++;
        } else {
            //echo "Error Insert data to new table";
            $gagal++;
        }
    }
    //Endwhile
    echo "<p>Horreee.. !! Data Kas berhasil di upgrade. Berhasil di transfer {$berhasil} item, Gagal di transfer {$gagal} item. Selesai</p>";
    if ($berhasil != 0) {
        $finish_query = mysql_query("DROP TABLE buku, kas, pinjaman,tempo");
        //Daffuk we
        if ($finish_query) {
            catat("SISTEM", "Berhasil Upgrade ke versi " . getVersion());
            echo "<a href='?upgrade=finish' class='btn btn-success'>Selesai >></a>";
        } else {
            echo "Unable to drop old tables, do it manualy :D<br>" . mysql_error();
        }
    }
    exit(0);
} elseif ($mode == 'finish') {
    echo "<h1>Horeee..</h1><p>Versi Libska berhasil di update, versi saat ini adalah " . getVersion() . ".<br>Silahkan hapus / rename folder upgrade pada direktori utama :D.</p>";
    echo "<a href='../index.php?upgrade=selesai' class='btn'>Kembali Ke laptop >></a>";
}
?>
            
        </div>
    </div>
</body>
</html>
<?php 
putus();
Example #15
0
 function getVersion()
 {
     return getVersion();
 }
 /**
  * Installs or upgrades a module from it's directory
  * Checks dependencies, and enables
  * @param string   The name of the module to install
  * @param bool     If true, skips status and dependency checks
  * @return mixed   True if succesful, array of error messages if not succesful
  */
 function install($modulename, $force = false)
 {
     $this->modDepends = array();
     $this->notFound = false;
     global $db, $amp_conf;
     set_time_limit($this->maxTimeLimit);
     $modules = $this->getinfo($modulename);
     // make sure we have a directory, to begin with
     $dir = $amp_conf['AMPWEBROOT'] . '/admin/modules/' . $modulename;
     if (!is_dir($dir)) {
         $this->notFound = true;
         return array(_("Cannot find module"));
     }
     // read the module.xml file
     $modules = $this->getinfo($modulename);
     if (!isset($modules[$modulename])) {
         return array(_("Could not read module.xml"));
     }
     // don't force this bit - we can't install a broken module (missing files)
     if ($modules[$modulename]['status'] == MODULE_STATUS_BROKEN) {
         return array(_("Module " . $modules[$modulename]['rawname'] . " is broken and cannot be installed. You should try to download it again."));
     }
     $mod = FreePBX::GPG()->verifyModule($modulename);
     $revoked = $mod['status'] & GPG::STATE_REVOKED;
     if ($revoked) {
         return array(_("Module " . $modulename . " has a revoked signature and cannot be installed"));
     }
     if (!$force) {
         if (!in_array($modules[$modulename]['status'], array(MODULE_STATUS_ENABLED, MODULE_STATUS_NOTINSTALLED, MODULE_STATUS_NEEDUPGRADE))) {
             //return array(_("This module is already installed."));
             // This isn't really an error, we just exit
             return true;
         }
         // check dependencies
         if (is_array($errors = $this->checkdepends($modules[$modulename]))) {
             return $errors;
         }
     }
     // Check if another module wants this install to be rejected
     // The module must have a callback: [modulename]_module_install_check_callback() that takes
     // a single modules array from module_getinfo() about the module to be installed
     // and it must pass back boolean true if the installation can proceed, or a message
     // indicating why the installation must fail
     //
     $rejects = array();
     //We need to include developer files before the callback happens during an install
     if (!$this->_runscripts_include($modules, 'install')) {
         return array(_("Failed to run installation scripts"));
     }
     foreach (mod_func_iterator('module_install_check_callback', $modules) as $mod => $res) {
         if ($res !== true) {
             $rejects[] = $res;
         }
     }
     if (!empty($rejects)) {
         return $rejects;
     }
     //Developer mode, remind them they need to run install_amp manually
     //run this before the install scripts below because they end up removing install.php...yup
     if ($modulename == 'framework' && !file_exists($dir . '/install.php')) {
         out(_("Framework has been detected as being in Developer mode, Please make sure to run './install_amp --update-links' manually so that any database or system settings can be updated"));
     }
     // run the scripts
     if (!$this->_runscripts($modulename, 'install', $modules)) {
         return array(_("Failed to run installation scripts"));
     }
     if ($modules[$modulename]['status'] == MODULE_STATUS_NOTINSTALLED) {
         // customize INSERT query
         $sql = "INSERT INTO modules (modulename, version, enabled) values ('" . $db->escapeSimple($modules[$modulename]['rawname']) . "','" . $db->escapeSimple($modules[$modulename]['version']) . "', 1);";
     } else {
         // just need to update the version
         $sql = "UPDATE modules SET version='" . $db->escapeSimple($modules[$modulename]['version']) . "' WHERE modulename = '" . $db->escapeSimple($modules[$modulename]['rawname']) . "'";
     }
     // run query
     $results = $db->query($sql);
     if (DB::IsError($results)) {
         return array(sprintf(_("Error updating database. Command was: %s; error was: %s "), $sql, $results->getMessage()));
     }
     // If module is framework then update the framework version
     // normally this is done inside of the funky upgrade script runner but we are changing this now as
     // framework and freepbx versions are the same
     if ($modulename == 'framework' && !empty($modules[$modulename]['version']) && getVersion() != $modules[$modulename]['version']) {
         out(sprintf(_("Framework Detected, Setting FreePBX Version to %s"), $modules[$modulename]['version']));
         $sql = "UPDATE admin SET value = '" . $db->escapeSimple($modules[$modulename]['version']) . "' WHERE variable = 'version'";
         $result = $db->query($sql);
         if (DB::IsError($result)) {
             die($result->getMessage());
         }
         if (getVersion() != $modules[$modulename]['version']) {
             die(_('Internal Error. Function getVersion did not match the Framework version, even after it was suppose to be applied'));
         }
     }
     // module is now installed & enabled, invalidate the modulelist class since it is now stale
     $modulelist =& modulelist::create($db);
     $modulelist->invalidate();
     // edit the notification table to list any remaining upgrades available or clear
     // it if none are left. It requres a copy of the most recent module_xml to compare
     // against the installed modules.
     //
     $sql = 'SELECT data FROM module_xml WHERE id = "xml"';
     $data = sql($sql, "getOne");
     $parser = new xml2ModuleArray($data);
     $xmlarray = $parser->parseAdvanced($data);
     $new_modules = array();
     if (count($xmlarray)) {
         foreach ($xmlarray['xml']['module'] as $mod) {
             $new_modules[$mod['rawname']] = $mod;
         }
     }
     $this->upgrade_notifications($new_modules, 'PASSIVE');
     needreload();
     FreePBX::Config()->update("SIGNATURECHECK", true);
     $db->query("DELETE FROM admin WHERE variable = 'unsigned' LIMIT 1");
     //Generate LESS on install
     //http://issues.freepbx.org/browse/FREEPBX-8287
     outn(_("Generating CSS..."));
     try {
         if ($modulename == 'framework') {
             FreePBX::Less()->generateMainStyles();
         } else {
             FreePBX::Less()->generateModuleStyles($modulename);
         }
     } catch (\Exception $e) {
     }
     out(_("Done"));
     return true;
 }
Example #17
0
function DisplayUpdates()
{
    global $LNG;
    $Patchlevel = getVersion();
    $template = new template();
    $template->loadscript('update.js');
    $template->assign_vars(array('up_submit' => $LNG['up_submit'], 'up_version' => $LNG['up_version'], 'up_revision' => $LNG['up_revision'], 'up_add' => $LNG['up_add'], 'up_edit' => $LNG['up_edit'], 'up_del' => $LNG['up_del'], 'ml_from' => $LNG['ml_from'], 'up_aktuelle_updates' => $LNG['up_aktuelle_updates'], 'up_momentane_version' => $LNG['up_momentane_version'], 'up_alte_updates' => $LNG['up_alte_updates'], 'up_download' => $LNG['up_download_patch_files'], 'version' => implode('.', $Patchlevel), 'RevList' => json_encode(GetLogs(isset($_REQUEST['history']) ? 0 : $Patchlevel[2])), 'Rev' => $Patchlevel[2], 'canDownload' => function_exists('gzcompress')));
    $template->show('UpdatePage.tpl');
}
Example #18
0
/**
 * List available Administration Tasks
 *
 * @author Andreas Gohr <*****@*****.**>
 * @author Håkan Sandell <*****@*****.**>
 */
function html_admin()
{
    global $ID;
    global $INFO;
    global $lang;
    global $conf;
    global $auth;
    // build menu of admin functions from the plugins that handle them
    $pluginlist = plugin_list('admin');
    $menu = array();
    foreach ($pluginlist as $p) {
        if (($obj =& plugin_load('admin', $p)) === null) {
            continue;
        }
        // check permissions
        if ($obj->forAdminOnly() && !$INFO['isadmin']) {
            continue;
        }
        $menu[$p] = array('plugin' => $p, 'prompt' => $obj->getMenuText($conf['lang']), 'sort' => $obj->getMenuSort());
    }
    // data security check
    // @todo: could be checked and only displayed if $conf['savedir'] is under the web root
    echo '<a style="border:none; float:right;"
            href="http://www.dokuwiki.org/security#web_access_security">
            <img src="data/security.png" alt="Your data directory seems to be protected properly."
             onerror="this.parentNode.style.display=\'none\'" /></a>';
    print p_locale_xhtml('admin');
    // Admin Tasks
    if ($INFO['isadmin']) {
        ptln('<ul class="admin_tasks">');
        if ($menu['usermanager'] && $auth && $auth->canDo('getUsers')) {
            ptln('  <li class="admin_usermanager"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'usermanager')) . '">' . $menu['usermanager']['prompt'] . '</a></div></li>');
        }
        unset($menu['usermanager']);
        if ($menu['acl']) {
            ptln('  <li class="admin_acl"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'acl')) . '">' . $menu['acl']['prompt'] . '</a></div></li>');
        }
        unset($menu['acl']);
        if ($menu['plugin']) {
            ptln('  <li class="admin_plugin"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'plugin')) . '">' . $menu['plugin']['prompt'] . '</a></div></li>');
        }
        unset($menu['plugin']);
        if ($menu['config']) {
            ptln('  <li class="admin_config"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'config')) . '">' . $menu['config']['prompt'] . '</a></div></li>');
        }
        unset($menu['config']);
    }
    ptln('</ul>');
    // Manager Tasks
    ptln('<ul class="admin_tasks">');
    if ($menu['revert']) {
        ptln('  <li class="admin_revert"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'revert')) . '">' . $menu['revert']['prompt'] . '</a></div></li>');
    }
    unset($menu['revert']);
    if ($menu['popularity']) {
        ptln('  <li class="admin_popularity"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'popularity')) . '">' . $menu['popularity']['prompt'] . '</a></div></li>');
    }
    unset($menu['popularity']);
    // print DokuWiki version:
    ptln('</ul>');
    echo '<div id="admin__version">';
    echo getVersion();
    echo '</div>';
    // print the rest as sorted list
    if (count($menu)) {
        usort($menu, 'p_sort_modes');
        // output the menu
        ptln('<div class="clearer"></div>');
        print p_locale_xhtml('adminplugins');
        ptln('<ul>');
        foreach ($menu as $item) {
            if (!$item['prompt']) {
                continue;
            }
            ptln('  <li><div class="li"><a href="' . wl($ID, 'do=admin&amp;page=' . $item['plugin']) . '">' . $item['prompt'] . '</a></div></li>');
        }
        ptln('</ul>');
    }
}
Example #19
0
    echo '<p style="text-align:center; ">';
    echo JText::_('COM_JOOMLEAGUE_DB_UPDATE_INFO_UNKNOWN_ETC') . '<br />';
    echo JText::_('COM_JOOMLEAGUE_DB_UPDATE_INFO_JUST_INFOTEXT') . '<br />';
    echo '</p>';
}
echo '<hr>';
/**/
if (getUpdatePart() == 1) {
    echo '<p>';
    echo '<h3>';
    echo '<span style="color:orange">';
    echo JText::sprintf('COM_JOOMLEAGUE_DB_UPDATE_DELETE_WARNING', '</span><b><i><a href="index.php?option=com_user&task=logout">', '</i></b></a><span style="color:orange">');
    echo '</span>';
    echo '</h3>';
    echo '</p>';
    $JLTablesVersion = getVersion();
    if ($JLTablesVersion != '' && $JLTablesVersion < '0.93') {
        echo '<span style="color:red">';
        echo JText::_('COM_JOOMLEAGUE_DB_UPDATE_ATTENTION');
        echo '<br /><br />';
        echo JText::_('You are updating from an older release of JoomLeague than 0.93!');
        echo '<br />';
        echo JText::sprintf('Actually your JoomLeague-MYSQL-Tables are ready for JoomLeague v%1$s', '<b>' . $JLTablesVersion . '</b>');
        echo '<br />';
        echo JText::_('Update may not be completely sucessfull as we require JoomLeague-MYSQL-tables according to the release 0.93!');
        echo '</span><br />';
        echo '<span style="color:green">';
        echo JText::sprintf('It would be better to update your JoomLeague installation to v0.93 before you update to JoomLeague %1$s!', '<b>' . $version . '</b>');
        echo '</span><br /><br />';
        echo '<span style="color:red">' . JText::_('COM_JOOMLEAGUE_DB_UPDATE_DANGER') . '</span><br /><br />';
        echo '<span style="color:red">' . JText::_('This script also DELETES the content of some JoomLeague v1.5 related tables inside your database without warning to update them by using the data of the JoomLeague 0.93b tables!!!') . '</span><br />';
Example #20
0
function doBackup($tables, $OutType, $OutDest, $toBackUp, $UserAgent, $local_backup_path, &$databaseResult, $backupname, $excltables = array(), $dbname)
{
    global $database, $mosConfig_db, $mosConfig_sitename, $version, $option, $task, $mosConfig_dbprefix, $_CONFIG, $mosConfig_user, $mosConfig_password, $mosConfig_host;
    if (!$tables[0]) {
        $databaseResult = LM_DATABASE_MISSING_TABLES;
        return;
    }
    /* Determine the mime type and file extension for the output file */
    if ($OutType == "zip") {
        $filename = $backupname . "-sql" . ".zip";
    } elseif ($OutType == "html") {
        $filename = $backupname . "-sql" . ".html";
    } else {
        $filename = $backupname . "-sql" . ".sql";
    }
    $sqlfile = "{$local_backup_path}/{$filename}";
    @unlink($sqlfile);
    /* Store all the tables we want to back-up in variable $tables[] */
    if ($tables[0] == "all") {
        array_pop($tables);
        $query = mysql_query("SHOW tables");
        while ($row = mysql_fetch_array($query)) {
            $tables_list[] = $row[0];
        }
        $tables = array_merge($tables, $tables_list);
    }
    $newtables = array();
    #if(is_array($excltables))
    foreach ($tables as $key => $value) {
        if (is_array($excltables)) {
            if (!in_array($value, $excltables)) {
                $newtables[] = $value;
            }
        } else {
            $newtables[] = $value;
        }
    }
    if (sizeof($tables) == sizeof($newtables)) {
        $ex_dump = "";
    } else {
        $ex_dump = @implode(" ", $newtables);
    }
    $tables = $newtables;
    if ($_REQUEST['dbbackup_drop']) {
        $drop = " --add-drop-table";
    } else {
        $drop = "";
    }
    if ($_REQUEST['dbbackup_comp']) {
        $drop .= " --compatible=" . strtolower($_REQUEST['dbbackup_comp']) . " ";
    }
    if ($_CONFIG['sql_mem']) {
        exec($_CONFIG[sqldump] . " -h " . $_CONFIG['mysql_host'] . " -u " . $_CONFIG['mysql_user'] . " -p" . $_CONFIG['mysql_pass'] . " " . $dbname . " > " . $sqlfile . " {$drop} --allow-keywords " . $ex_dump);
        if (filesize($sqlfile)) {
            $databaseResult = LM_DATABASE_BACKUP_COMPLETED . ' ( ' . getFileSizeText(filesize($sqlfile)) . ' )';
        } else {
            $databaseResult = LM_MSG_BACK_14;
        }
        exec("chmod 777 {$sqlfile}");
        return $sqlfile;
    }
    /*Added some default values for quotes and auto_increment problems*/
    mysql_query("SET SQL_QUOTE_SHOW_CREATE=1;");
    mysql_query("SET sql_mode = 0;");
    if ($_REQUEST['dbbackup_comp']) {
        mysql_query("SET sql_mode=" . $_REQUEST['dbbackup_comp'] . ";");
    }
    /* Store the "Create Tables" SQL in variable $CreateTable[$tblval] */
    if ($toBackUp != "data") {
        foreach ($tables as $tblval) {
            $query = mysql_query("SHOW CREATE table `{$tblval}`");
            $row = mysql_fetch_array($query);
            $CreateTable[$tblval] = $row[1];
        }
    }
    /* Store all the FIELD TYPES being backed-up (text fields need to be delimited) in variable $FieldType*/
    if ($toBackUp != "structure") {
        foreach ($tables as $tblval) {
            $query = mysql_query("SHOW FIELDS FROM {$tblval}");
            while ($row = mysql_fetch_row($query)) {
                $fields[] = $row[0];
            }
            foreach ($fields as $field) {
                $FieldType[$tblval][$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type);
            }
        }
    }
    if ($OutDest == "local") {
        $fp = fopen($sqlfile, "w");
        if (!$fp) {
            $databaseResult = LM_DATABASE_BACKUP_FAILED;
            return;
        }
    }
    /* Build the fancy header on the dump file */
    $OutBuffer = "";
    if ($OutType == 'html') {
    } else {
        $OutBuffer .= "#\n";
        $OutBuffer .= "# Powered by XCloner Site Backup\n";
        $OutBuffer .= "# http://www.joomlaplug.com\n";
        $OutBuffer .= "#\n";
        $OutBuffer .= "# Host: " . $_SERVER['HTTP_HOST'] . "\n";
        $OutBuffer .= "# Generation Time: " . date("M j, Y \\a\\t H:i") . "\n";
        $OutBuffer .= "# Server version: " . getVersion() . "\n";
        $OutBuffer .= "# PHP Version: " . phpversion() . "\n";
        $OutBuffer .= "# Database : `" . $dbname . "`\n# --------------------------------------------------------\n";
    }
    fwrite($fp, $OutBuffer);
    unset($OutBuffer);
    /* Okay, here's the meat & potatoes */
    foreach ($tables as $tblval) {
        if ($toBackUp != "data") {
            if ($OutType == 'html') {
            } else {
                $OutBuffer .= "#\n# Table structure for table `{$tblval}`\n#\n";
                if ($_REQUEST['dbbackup_drop']) {
                    $OutBuffer .= "#\nDROP table IF EXISTS {$tblval};\n";
                }
                $OutBuffer .= $CreateTable[$tblval] . ";\r\n";
            }
        }
        fwrite($fp, $OutBuffer);
        unset($OutBuffer);
        if ($toBackUp != "structure") {
            $OutBuffer .= "#\n# Dumping data for table `{$tblval}`\n#\n";
            $query = @mysql_query("SELECT *  FROM {$tblval}");
            while ($row = @mysql_fetch_array($query, MYSQL_ASSOC)) {
                $InsertDump = "INSERT INTO {$tblval} VALUES (";
                $arr = $row;
                foreach ($arr as $key => $value) {
                    $value = addslashes($value);
                    $value = str_replace("\n", '\\r\\n', $value);
                    $value = str_replace("\r", '', $value);
                    $InsertDump .= "'{$value}',";
                    /*else
                      {
                          $InsertDump .= "'$value',";
                      } */
                }
                $OutBuffer .= rtrim($InsertDump, ',') . ");\n";
                fwrite($fp, $OutBuffer);
                unset($OutBuffer);
                $i++;
            }
        }
    }
    if ($OutDest == "local") {
        #fwrite($fp, $OutBuffer);
        fclose($fp);
        @chmod($sqlfile, 0777);
        $databaseResult = LM_DATABASE_BACKUP_COMPLETED . ' ( ' . getFileSizeText(filesize($sqlfile)) . ' )';
        return $sqlfile;
    }
}
Example #21
0
/**
 * Run a few sanity checks
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function check()
{
    global $conf;
    global $INFO;
    if ($INFO['isadmin'] || $INFO['ismanager']) {
        msg('DokuWiki version: ' . getVersion(), 1);
    }
    if (version_compare(phpversion(), '5.2.0', '<')) {
        msg('Your PHP version is too old (' . phpversion() . ' vs. 5.2.0+ needed)', -1);
    } else {
        msg('PHP version ' . phpversion(), 1);
    }
    $mem = (int) php_to_byte(ini_get('memory_limit'));
    if ($mem) {
        if ($mem < 16777216) {
            msg('PHP is limited to less than 16MB RAM (' . $mem . ' bytes). Increase memory_limit in php.ini', -1);
        } elseif ($mem < 20971520) {
            msg('PHP is limited to less than 20MB RAM (' . $mem . ' bytes), you might encounter problems with bigger pages. Increase memory_limit in php.ini', -1);
        } elseif ($mem < 33554432) {
            msg('PHP is limited to less than 32MB RAM (' . $mem . ' bytes), but that should be enough in most cases. If not, increase memory_limit in php.ini', 0);
        } else {
            msg('More than 32MB RAM (' . $mem . ' bytes) available.', 1);
        }
    }
    if (is_writable($conf['changelog'])) {
        msg('Changelog is writable', 1);
    } else {
        if (@file_exists($conf['changelog'])) {
            msg('Changelog is not writable', -1);
        }
    }
    if (isset($conf['changelog_old']) && @file_exists($conf['changelog_old'])) {
        msg('Old changelog exists', 0);
    }
    if (@file_exists($conf['changelog'] . '_failed')) {
        msg('Importing old changelog failed', -1);
    } else {
        if (@file_exists($conf['changelog'] . '_importing')) {
            msg('Importing old changelog now.', 0);
        } else {
            if (@file_exists($conf['changelog'] . '_import_ok')) {
                msg('Old changelog imported', 1);
                if (!plugin_isdisabled('importoldchangelog')) {
                    msg('Importoldchangelog plugin not disabled after import', -1);
                }
            }
        }
    }
    if (is_writable(DOKU_CONF)) {
        msg('conf directory is writable', 1);
    } else {
        msg('conf directory is not writable', -1);
    }
    if ($conf['authtype'] == 'plain') {
        global $config_cascade;
        if (is_writable($config_cascade['plainauth.users']['default'])) {
            msg('conf/users.auth.php is writable', 1);
        } else {
            msg('conf/users.auth.php is not writable', 0);
        }
    }
    if (function_exists('mb_strpos')) {
        if (defined('UTF8_NOMBSTRING')) {
            msg('mb_string extension is available but will not be used', 0);
        } else {
            msg('mb_string extension is available and will be used', 1);
            if (ini_get('mbstring.func_overload') != 0) {
                msg('mb_string function overloading is enabled, this will cause problems and should be disabled', -1);
            }
        }
    } else {
        msg('mb_string extension not available - PHP only replacements will be used', 0);
    }
    if (!UTF8_PREGSUPPORT) {
        msg('PHP is missing UTF-8 support in Perl-Compatible Regular Expressions (PCRE)', -1);
    }
    if (!UTF8_PROPERTYSUPPORT) {
        msg('PHP is missing Unicode properties support in Perl-Compatible Regular Expressions (PCRE)', -1);
    }
    $loc = setlocale(LC_ALL, 0);
    if (!$loc) {
        msg('No valid locale is set for your PHP setup. You should fix this', -1);
    } elseif (stripos($loc, 'utf') === false) {
        msg('Your locale <code>' . hsc($loc) . '</code> seems not to be a UTF-8 locale, you should fix this if you encounter problems.', 0);
    } else {
        msg('Valid locale ' . hsc($loc) . ' found.', 1);
    }
    if ($conf['allowdebug']) {
        msg('Debugging support is enabled. If you don\'t need it you should set $conf[\'allowdebug\'] = 0', -1);
    } else {
        msg('Debugging support is disabled', 1);
    }
    if ($INFO['userinfo']['name']) {
        msg('You are currently logged in as ' . $_SERVER['REMOTE_USER'] . ' (' . $INFO['userinfo']['name'] . ')', 0);
        msg('You are part of the groups ' . join($INFO['userinfo']['grps'], ', '), 0);
    } else {
        msg('You are currently not logged in', 0);
    }
    msg('Your current permission for this page is ' . $INFO['perm'], 0);
    if (is_writable($INFO['filepath'])) {
        msg('The current page is writable by the webserver', 0);
    } else {
        msg('The current page is not writable by the webserver', 0);
    }
    if ($INFO['writable']) {
        msg('The current page is writable by you', 0);
    } else {
        msg('The current page is not writable by you', 0);
    }
    // Check for corrupted search index
    $lengths = idx_listIndexLengths();
    $index_corrupted = false;
    foreach ($lengths as $length) {
        if (count(idx_getIndex('w', $length)) != count(idx_getIndex('i', $length))) {
            $index_corrupted = true;
            break;
        }
    }
    foreach (idx_getIndex('metadata', '') as $index) {
        if (count(idx_getIndex($index . '_w', '')) != count(idx_getIndex($index . '_i', ''))) {
            $index_corrupted = true;
            break;
        }
    }
    if ($index_corrupted) {
        msg('The search index is corrupted. It might produce wrong results and most
                probably needs to be rebuilt. See
                <a href="http://www.dokuwiki.org/faq:searchindex">faq:searchindex</a>
                for ways to rebuild the search index.', -1);
    } elseif (!empty($lengths)) {
        msg('The search index seems to be working', 1);
    } else {
        msg('The search index is empty. See
                <a href="http://www.dokuwiki.org/faq:searchindex">faq:searchindex</a>
                for help on how to fix the search index. If the default indexer
                isn\'t used or the wiki is actually empty this is normal.');
    }
}
Example #22
0
            }
            $textwithlinks .= "</tr>\n";
        }
        $textwithlinks .= "</table>\n";
    }
    if ($cleantext != "" && isset($_REQUEST['pastebin'])) {
        $url = pastebin($cleantext, $name);
        $pastebin = "Pastebin url: <a href=\"{$url}\" target=\"_blank\">{$url}</a>";
    }
    $cleantext = "<h1>translated for copy and paste</h1>\n<pre>{$cleantext}</pre>";
    return array('PASTEBIN' => $pastebin, 'RESULTCLEAN' => $cleantext, 'RESULTHTML' => $textwithlinks);
}
$res['PASTEBIN'] = "";
/*initianlize vars for template*/
$res['RESULTHTML'] = "";
$res['RESULTCLEAN'] = "";
$res['TEXTAREA'] = getinfolog();
$res['TRANSLATOR'] = "http://springrts.com:8000";
$res['INFO'] = "";
if ($res['TEXTAREA'] != "") {
    limit();
    $tmp = xmlrpcrequest($res['TRANSLATOR'], $res['TEXTAREA']);
    /*	if (array_key_exists('faultString',$tmp)){
    		$res['INFO']="<h1>Warning: using local translator, as remote can't translate</h1>";
    		$res['TRANSLATOR']="http://abma.de:8000";
    		$tmp=xmlrpcrequest($res['TRANSLATOR'],$res['TEXTAREA']);
    	}*/
    $res = array_merge($res, parse_result($tmp, getVersion($res['TEXTAREA'])));
}
$res['ACTION'] = $_SERVER['SCRIPT_NAME'];
echo parse_template("index.tpl", $res);
Example #23
0
 /**
  * Gather all information
  *
  * @return array The popularity data as an array
  */
 function _gather()
 {
     global $conf;
     /** @var $auth DokuWiki_Auth_Plugin */
     global $auth;
     $data = array();
     $phptime = ini_get('max_execution_time');
     @set_time_limit(0);
     $pluginInfo = $this->getInfo();
     // version
     $data['anon_id'] = md5(auth_cookiesalt());
     $data['version'] = getVersion();
     $data['popversion'] = $pluginInfo['date'];
     $data['language'] = $conf['lang'];
     $data['now'] = time();
     $data['popauto'] = (int) $this->isAutoSubmitEnabled();
     // some config values
     $data['conf_useacl'] = $conf['useacl'];
     $data['conf_authtype'] = $conf['authtype'];
     $data['conf_template'] = $conf['template'];
     // number and size of pages
     $list = array();
     search($list, $conf['datadir'], array($this, '_search_count'), array('all' => false), '');
     $data['page_count'] = $list['file_count'];
     $data['page_size'] = $list['file_size'];
     $data['page_biggest'] = $list['file_max'];
     $data['page_smallest'] = $list['file_min'];
     $data['page_nscount'] = $list['dir_count'];
     $data['page_nsnest'] = $list['dir_nest'];
     if ($list['file_count']) {
         $data['page_avg'] = $list['file_size'] / $list['file_count'];
     }
     $data['page_oldest'] = $list['file_oldest'];
     unset($list);
     // number and size of media
     $list = array();
     search($list, $conf['mediadir'], array($this, '_search_count'), array('all' => true));
     $data['media_count'] = $list['file_count'];
     $data['media_size'] = $list['file_size'];
     $data['media_biggest'] = $list['file_max'];
     $data['media_smallest'] = $list['file_min'];
     $data['media_nscount'] = $list['dir_count'];
     $data['media_nsnest'] = $list['dir_nest'];
     if ($list['file_count']) {
         $data['media_avg'] = $list['file_size'] / $list['file_count'];
     }
     unset($list);
     // number and size of cache
     $list = array();
     search($list, $conf['cachedir'], array($this, '_search_count'), array('all' => true));
     $data['cache_count'] = $list['file_count'];
     $data['cache_size'] = $list['file_size'];
     $data['cache_biggest'] = $list['file_max'];
     $data['cache_smallest'] = $list['file_min'];
     if ($list['file_count']) {
         $data['cache_avg'] = $list['file_size'] / $list['file_count'];
     }
     unset($list);
     // number and size of index
     $list = array();
     search($list, $conf['indexdir'], array($this, '_search_count'), array('all' => true));
     $data['index_count'] = $list['file_count'];
     $data['index_size'] = $list['file_size'];
     $data['index_biggest'] = $list['file_max'];
     $data['index_smallest'] = $list['file_min'];
     if ($list['file_count']) {
         $data['index_avg'] = $list['file_size'] / $list['file_count'];
     }
     unset($list);
     // number and size of meta
     $list = array();
     search($list, $conf['metadir'], array($this, '_search_count'), array('all' => true));
     $data['meta_count'] = $list['file_count'];
     $data['meta_size'] = $list['file_size'];
     $data['meta_biggest'] = $list['file_max'];
     $data['meta_smallest'] = $list['file_min'];
     if ($list['file_count']) {
         $data['meta_avg'] = $list['file_size'] / $list['file_count'];
     }
     unset($list);
     // number and size of attic
     $list = array();
     search($list, $conf['olddir'], array($this, '_search_count'), array('all' => true));
     $data['attic_count'] = $list['file_count'];
     $data['attic_size'] = $list['file_size'];
     $data['attic_biggest'] = $list['file_max'];
     $data['attic_smallest'] = $list['file_min'];
     if ($list['file_count']) {
         $data['attic_avg'] = $list['file_size'] / $list['file_count'];
     }
     $data['attic_oldest'] = $list['file_oldest'];
     unset($list);
     // user count
     if ($auth && $auth->canDo('getUserCount')) {
         $data['user_count'] = $auth->getUserCount();
     }
     // calculate edits per day
     $list = @file($conf['metadir'] . '/_dokuwiki.changes');
     $count = count($list);
     if ($count > 2) {
         $first = (int) substr(array_shift($list), 0, 10);
         $last = (int) substr(array_pop($list), 0, 10);
         $dur = ($last - $first) / (60 * 60 * 24);
         // number of days in the changelog
         $data['edits_per_day'] = $count / $dur;
     }
     unset($list);
     // plugins
     $data['plugin'] = plugin_list();
     // pcre info
     if (defined('PCRE_VERSION')) {
         $data['pcre_version'] = PCRE_VERSION;
     }
     $data['pcre_backtrack'] = ini_get('pcre.backtrack_limit');
     $data['pcre_recursion'] = ini_get('pcre.recursion_limit');
     // php info
     $data['os'] = PHP_OS;
     $data['webserver'] = $_SERVER['SERVER_SOFTWARE'];
     $data['php_version'] = phpversion();
     $data['php_sapi'] = php_sapi_name();
     $data['php_memory'] = $this->_to_byte(ini_get('memory_limit'));
     $data['php_exectime'] = $phptime;
     $data['php_extension'] = get_loaded_extensions();
     // plugin usage data
     $this->_add_plugin_usage_data($data);
     return $data;
 }
/**
 * Prints the zenphoto version string
 */
function printVersion()
{
    echo getVersion();
}
Example #25
0
// Get the function files
require_once './server/functions.php';
// Get the configuration
require_once './server/read-main.php';
require_once './server/read-hosts.php';
// Get some extra-libs
require_once './server/gettext.php';
// Prepare application
enableErrorSink();
hideErrors();
compressThis();
// Include the good language file
$locale = checkLanguage();
includeTranslation($locale, 'main');
// Get the Jappix version & its hash
$version = getVersion();
$hash = genHash($version);
// Include the good application file
$include_app = 'desktop';
// App to include?
if (!isInstalled()) {
    // Not yet installed
    $include_app = 'install';
} else {
    if (anonymousMode()) {
        // Anonymous
        $include_app = 'desktop';
    } else {
        if (isset($_GET['m']) && !empty($_GET['m'])) {
            // Not anonymous, any forced mode?
            $force_mode = $_GET['m'];
Example #26
0
 /**
  * バージョンを取得する
  */
 public function testGetVersion()
 {
     // BaserCMSコアのバージョン取得
     $result = getVersion();
     $version = file(BASER . 'VERSION.txt');
     $Bcversion = substr($version[0], 0, -1);
     $this->assertEquals($Bcversion, $result, 'BaserCMSコアのバージョンを正しく取得できません');
     $result = getVersion('Blog');
     $this->assertEquals($Bcversion, $result, 'BaserCMSコアのバージョンを正しく取得できません');
     // プラグインのバージョンを取得
     // ダミーのプラグインを作成
     $path = APP . 'Plugin' . DS . 'Hoge' . DS;
     $Folder = new Folder($path, true);
     $File = new File($path . 'VERSION.txt', true);
     $File->write('1.2.3');
     $result = getVersion('Hoge');
     $File->close();
     $Folder->delete();
     $this->assertEquals('1.2.3', $result, 'プラグインのバージョンを取得できません');
 }
function newUpdates($force)
{
    // No need to check if developer mode
    if (isDeveloper()) {
        return false;
    }
    $cache_path = JAPPIX_BASE . '/store/updates/version.xml';
    // No cache, obsolete one or refresh forced
    if (!file_exists($cache_path) || file_exists($cache_path) && time() - filemtime($cache_path) >= 86400 || $force) {
        // Get the content
        $last_version = read_url('http://codingteam.net/project/jappix/upload/briefcase/version.xml');
        // Write the content
        file_put_contents($cache_path, $last_version);
    } else {
        $last_version = file_get_contents($cache_path);
    }
    // Parse the XML
    $xml = @simplexml_load_string($last_version);
    // No data?
    if ($xml === FALSE) {
        return false;
    }
    // Get the version numbers
    $current_version = getVersion();
    $last_version = $xml->id;
    // Check if we have the latest version
    $current_version = versionNumber($current_version);
    $last_version = versionNumber($last_version);
    if ($current_version < $last_version) {
        return true;
    }
    return false;
}
Example #28
0
<!-- CONTENT START -->
<body class="detail">
<?php 
//print_r($musicData);
//print_r($versionList);
$d = getBaseData($musicData, $versionList);
$bpm = $d['bpm_min'] == $d['bpm_max'] ? $d['bpm_max'] : $d['bpm_min'] . "-" . $d['bpm_max'];
$v = getVersion($versionList);
$verAC = $v['ac'];
$verCS = $v['cs'];
$html = <<<HTML_STR
<div class="article">
<div class="d_t">
<div id="mdetail_head"><a class="close">close</a></div>
<table id="mdetail_base">
<tr><th class="name" colspan="6">{$d['music_name']}</th></tr>
<tr><th>verAC</th><td colspan="5">{$verAC}</td></tr>
<tr><th>verCS</th><td colspan="5">{$verCS}</td></tr>
<tr><th>bpm</th><td colspan="5">{$bpm}</td>
<tr><th>bpm詳細</th><td colspan="5">{$d['bpm_detail']}</td></tr>
<tr><th>ジャンル</th><td colspan="5">{$d['genre_name']}</td></tr>
<tr><th>作者</th><td colspan="5">{$d['artist_name']}</td></tr>
</table>
<table id="mdetail_notes">
<tr><th class="SP" colspan="3">Single</th><th class="DP" colspan="3">Double</th></tr>
<tr><th>N7</th><td>{$d['spn']}</td><td>{$d['n7']}</td><th>N14</th><td>{$d['dpn']}</td><td>{$d['n14']}</td></tr>
<tr><th>H7</th><td>{$d['sph']}</td><td>{$d['h7']}</td><th>H14</th><td>{$d['dph']}</td><td>{$d['h14']}</td></tr>
<tr><th>A7</th><td>{$d['spa']}</td><td>{$d['a7']}</td><th>A14</th><td>{$d['dpa']}</td><td>{$d['a14']}</td></tr>
</table>
<table id="mdetail_dif_change">
<tr><th colspan="2">難度変更履歴</th></tr>
Example #29
0
     */
    loadSiteConfig();
    /**
     * メンテナンスチェック
     */
    $isMaintenance = $parameter == 'maintenance/index';
    Configure::write('BcRequest.isMaintenance', $isMaintenance);
    /**
     * アップデートチェック
     */
    $isUpdater = false;
    $bcSite = Configure::read('BcSite');
    $updateKey = preg_quote(Configure::read('BcApp.updateKey'), '/');
    if (preg_match('/^' . $updateKey . '(|\\/index\\/)/', $parameter)) {
        $isUpdater = true;
    } elseif (BC_INSTALLED && !$isMaintenance && (!empty($bcSite['version']) && getVersion() > $bcSite['version'])) {
        header('Location: ' . topLevelUrl(false) . baseUrl() . 'maintenance/index');
        exit;
    }
    Configure::write('BcRequest.isUpdater', $isUpdater);
}
/**
 * プラグインをCake側で有効化
 * 
 * カレントテーマのプラグインも読み込む
 */
if (BC_INSTALLED && !$isUpdater && !$isMaintenance) {
    App::build(array('Plugin' => array_merge(array(BASER_THEMES . $bcSite['theme'] . DS . 'Plugin' . DS), App::path('Plugin'))));
    $plugins = getEnablePlugins();
    foreach ($plugins as $plugin) {
        loadPlugin($plugin['Plugin']['name'], $plugin['Plugin']['priority']);
Example #30
0
/**
 * Run a few sanity checks
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function check()
{
    global $conf;
    global $INFO;
    msg('DokuWiki version: ' . getVersion(), 1);
    if (version_compare(phpversion(), '5.1.2', '<')) {
        msg('Your PHP version is too old (' . phpversion() . ' vs. 5.1.2+ needed)', -1);
    } else {
        msg('PHP version ' . phpversion(), 1);
    }
    $mem = (int) php_to_byte(ini_get('memory_limit'));
    if ($mem) {
        if ($mem < 16777216) {
            msg('PHP is limited to less than 16MB RAM (' . $mem . ' bytes). Increase memory_limit in php.ini', -1);
        } elseif ($mem < 20971520) {
            msg('PHP is limited to less than 20MB RAM (' . $mem . ' bytes), you might encounter problems with bigger pages. Increase memory_limit in php.ini', -1);
        } elseif ($mem < 33554432) {
            msg('PHP is limited to less than 32MB RAM (' . $mem . ' bytes), but that should be enough in most cases. If not, increase memory_limit in php.ini', 0);
        } else {
            msg('More than 32MB RAM (' . $mem . ' bytes) available.', 1);
        }
    }
    if (is_writable($conf['changelog'])) {
        msg('Changelog is writable', 1);
    } else {
        if (@file_exists($conf['changelog'])) {
            msg('Changelog is not writable', -1);
        }
    }
    if (isset($conf['changelog_old']) && @file_exists($conf['changelog_old'])) {
        msg('Old changelog exists', 0);
    }
    if (@file_exists($conf['changelog'] . '_failed')) {
        msg('Importing old changelog failed', -1);
    } else {
        if (@file_exists($conf['changelog'] . '_importing')) {
            msg('Importing old changelog now.', 0);
        } else {
            if (@file_exists($conf['changelog'] . '_import_ok')) {
                msg('Old changelog imported', 1);
                if (!plugin_isdisabled('importoldchangelog')) {
                    msg('Importoldchangelog plugin not disabled after import', -1);
                }
            }
        }
    }
    if (is_writable($conf['datadir'])) {
        msg('Datadir is writable', 1);
    } else {
        msg('Datadir is not writable', -1);
    }
    if (is_writable($conf['olddir'])) {
        msg('Attic is writable', 1);
    } else {
        msg('Attic is not writable', -1);
    }
    if (is_writable($conf['mediadir'])) {
        msg('Mediadir is writable', 1);
    } else {
        msg('Mediadir is not writable', -1);
    }
    if (is_writable($conf['cachedir'])) {
        msg('Cachedir is writable', 1);
    } else {
        msg('Cachedir is not writable', -1);
    }
    if (is_writable($conf['lockdir'])) {
        msg('Lockdir is writable', 1);
    } else {
        msg('Lockdir is not writable', -1);
    }
    if ($conf['authtype'] == 'plain') {
        if (is_writable(DOKU_CONF . 'users.auth.php')) {
            msg('conf/users.auth.php is writable', 1);
        } else {
            msg('conf/users.auth.php is not writable', 0);
        }
    }
    if (function_exists('mb_strpos')) {
        if (defined('UTF8_NOMBSTRING')) {
            msg('mb_string extension is available but will not be used', 0);
        } else {
            msg('mb_string extension is available and will be used', 1);
            if (ini_get('mbstring.func_overload') != 0) {
                msg('mb_string function overloading is enabled, this will cause problems and should be disabled', -1);
            }
        }
    } else {
        msg('mb_string extension not available - PHP only replacements will be used', 0);
    }
    if ($conf['allowdebug']) {
        msg('Debugging support is enabled. If you don\'t need it you should set $conf[\'allowdebug\'] = 0', -1);
    } else {
        msg('Debugging support is disabled', 1);
    }
    if ($INFO['userinfo']['name']) {
        msg('You are currently logged in as ' . $_SERVER['REMOTE_USER'] . ' (' . $INFO['userinfo']['name'] . ')', 0);
        msg('You are part of the groups ' . join($INFO['userinfo']['grps'], ', '), 0);
    } else {
        msg('You are currently not logged in', 0);
    }
    msg('Your current permission for this page is ' . $INFO['perm'], 0);
    if (is_writable($INFO['filepath'])) {
        msg('The current page is writable by the webserver', 0);
    } else {
        msg('The current page is not writable by the webserver', 0);
    }
    if ($INFO['writable']) {
        msg('The current page is writable by you', 0);
    } else {
        msg('The current page is not writable by you', 0);
    }
    require_once DOKU_INC . 'inc/HTTPClient.php';
    $check = wl('', '', true) . 'data/_dummy';
    $http = new DokuHTTPClient();
    $http->timeout = 6;
    $res = $http->get($check);
    if (strpos($res, 'data directory') !== false) {
        msg('It seems like the data directory is accessible from the web.
                Make sure this directory is properly protected
                (See <a href="http://www.dokuwiki.org/security">security</a>)', -1);
    } elseif ($http->status == 404 || $http->status == 403) {
        msg('The data directory seems to be properly protected', 1);
    } else {
        msg('Failed to check if the data directory is accessible from the web.
                Make sure this directory is properly protected
                (See <a href="http://www.dokuwiki.org/security">security</a>)', -1);
    }
}