コード例 #1
0
ファイル: tiki-db.php プロジェクト: hurcane/tiki-azure
 /**
  * @param TikiDb $db
  * @param $query
  * @param $values
  * @param $result
  */
 function handle(TikiDb $db, $query, $values, $result)
 {
     global $smarty, $prefs;
     $msg = $db->getErrorMessage();
     $q = $query;
     if (is_array($values)) {
         foreach ($values as $v) {
             if (is_null($v)) {
                 $v = 'NULL';
             } else {
                 $v = "'" . addslashes($v) . "'";
             }
             $pos = strpos($q, '?');
             if ($pos !== false) {
                 $q = substr($q, 0, $pos) . "{$v}" . substr($q, $pos + 1);
             }
         }
     }
     if (function_exists('xdebug_get_function_stack')) {
         /**
          * @param $stack
          * @return string
          */
         function mydumpstack($stack)
         {
             $o = '';
             foreach ($stack as $line) {
                 $o .= '* ' . $line['file'] . " : " . $line['line'] . " -> " . $line['function'] . "(" . var_export($line['params'], true) . ")<br />";
             }
             return $o;
         }
         $stacktrace = mydumpstack(xdebug_get_function_stack());
     } else {
         $stacktrace = false;
     }
     require_once 'installer/installlib.php';
     $installer = new Installer();
     require_once 'tiki-setup.php';
     $smarty->assign('msg', $msg);
     $smarty->assign('base_query', $query);
     $smarty->assign('values', $values);
     $smarty->assign('built_query', $q);
     $smarty->assign('stacktrace', $stacktrace);
     $smarty->assign('requires_update', $installer->requiresUpdate());
     header("Cache-Control: no-cache, pre-check=0, post-check=0");
     $smarty->display('database-connection-error.tpl');
     $this->log($msg . ' - ' . $q);
     die;
 }
コード例 #2
0
ファイル: bootstrap.php プロジェクト: linuxwhy/tiki-1
if (!$db) {
    die("\nUnable to connect to the database\n\n");
}
TikiDb::set($db);
global $tikilib;
require_once 'lib/tikilib.php';
$tikilib = new TikiLib();
// update db if needed
require_once 'lib/init/initlib.php';
include_once 'installer/installlib.php';
$installer = new Installer();
if (!$installer->tableExists('tiki_preferences')) {
    echo "Installing Tiki database...\n";
    $installer->cleanInstall();
} else {
    if ($installer->requiresUpdate()) {
        echo "Updating Tiki database...\n";
        $installer->update();
    }
}
$pwd = getcwd();
chdir(dirname(__FILE__) . '/../..');
$smarty = TikiLib::lib('smarty');
require_once 'lib/init/smarty.php';
$smarty->addPluginsDir('../smarty_tiki/');
$cachelib = TikiLib::lib('cache');
$wikilib = TikiLib::lib('wiki');
$userlib = TikiLib::lib('user');
$headerlib = TikiLib::lib('header');
require_once 'lib/init/tra.php';
$access = TikiLib::lib('access');
コード例 #3
0
ファイル: tiki-monitor.php プロジェクト: rjsmelo/tiki
            $sIpToCheck = $_SERVER['REMOTE_ADDR'];
        } else {
            $sIpToCheck = null;
        }
        if (in_array($sIpToCheck, $tikiMonitorRestriction) === false) {
            header('location: index.php');
        }
    } else {
        echo tra("\$tikiMonitorRestriction need to be an array");
        exit;
    }
}
$opcode_stats = TikiLib::lib('admin')->getOpcodeCacheStatus();
# TODO: The results will be wrong for WinCache
# The following is the relevant snippet from
# admin/include_performance.php
$txtUsed = tr('Used');
$txtAvailable = tr('Available');
if ($opcode_cache == 'WinCache') {
    // Somehow WinCache seems to flip the representations
    $txtAvailable = tr('Used');
    $txtUsed = tr('Available');
}
$result['OPCodeCache'] = $opcode_stats['opcode_cache'];
$result['OpCodeStats'] = $opcode_stats;
include_once 'installer/installlib.php';
$installer = new Installer();
$result['DbRequiresUpdate'] = $installer->requiresUpdate();
$result['SearchIndexRebuildLast'] = $tikilib->get_preference('unified_last_rebuild');
$display = json_encode($result);
echo $display;
コード例 #4
0
ファイル: console.php プロジェクト: jkimdon/cohomeals
    $console->add(new Tiki\Command\UnavailableCommand('database:update'));
}
$installer = $installer = new Installer();
$isInstalled = $installer->isInstalled();
if ($isInstalled) {
    $bypass_siteclose_check = true;
    require_once 'tiki-setup.php';
    $console->add(new Tiki\Command\CacheClearCommand());
    $console->add(new Tiki\Command\BackupDBCommand());
    $console->add(new Tiki\Command\BackupFilesCommand());
} else {
    $console->add(new Tiki\Command\UnavailableCommand('cache:clear'));
    $console->add(new Tiki\Command\UnavailableCommand('database:backup'));
    $console->add(new Tiki\Command\UnavailableCommand('backup:files'));
}
if ($isInstalled && !$installer->requiresUpdate()) {
    require_once 'tiki-setup.php';
    $console->add(new Tiki\Command\DailyReportSendCommand());
    $console->add(new Tiki\Command\IndexRebuildCommand());
    $console->add(new Tiki\Command\IndexOptimizeCommand());
    $console->add(new Tiki\Command\IndexCatchUpCommand());
    $console->add(new Tiki\Command\MailQueueSendCommand());
    $console->add(new Tiki\Command\ProfileForgetCommand());
    $console->add(new Tiki\Command\ProfileInstallCommand());
    $console->add(new Tiki\Command\ProfileExport\Init());
} else {
    $console->add(new Tiki\Command\UnavailableCommand('daily-report:send'));
    $console->add(new Tiki\Command\UnavailableCommand('index:rebuild'));
    $console->add(new Tiki\Command\UnavailableCommand('index:optimize'));
    $console->add(new Tiki\Command\UnavailableCommand('index:catch-up'));
    $console->add(new Tiki\Command\UnavailableCommand('mail-queue:send'));
コード例 #5
0
ファイル: tiki-db.php プロジェクト: linuxwhy/tiki-1
 /**
  * @param TikiDb $db
  * @param $query
  * @param $values
  * @param $result
  */
 function handle(TikiDb $db, $query, $values, $result)
 {
     global $prefs;
     $smarty = TikiLib::lib('smarty');
     $msg = $db->getErrorMessage();
     $q = $query;
     if (is_array($values)) {
         foreach ($values as $v) {
             if (is_null($v)) {
                 $v = 'NULL';
             } else {
                 $v = "'" . addslashes($v) . "'";
             }
             $pos = strpos($q, '?');
             if ($pos !== false) {
                 $q = substr($q, 0, $pos) . "{$v}" . substr($q, $pos + 1);
             }
         }
     }
     if (function_exists('xdebug_get_function_stack')) {
         $stacktrace = mydumpstack(xdebug_get_function_stack());
     } else {
         $stacktrace = false;
     }
     require_once 'installer/installlib.php';
     $installer = new Installer();
     require_once 'tiki-setup.php';
     $smarty->assign('msg', $msg);
     $smarty->assign('base_query', $query);
     $smarty->assign('values', $values);
     $smarty->assign('built_query', $q);
     $smarty->assign('stacktrace', $stacktrace);
     $smarty->assign('requires_update', $installer->requiresUpdate());
     header("Cache-Control: no-cache, pre-check=0, post-check=0");
     $smarty->display('database-connection-error.tpl');
     $this->log($msg . ' - ' . $q);
     die;
 }
コード例 #6
0
ファイル: tiki-admin.php プロジェクト: linuxwhy/tiki-1
    }, $upgrades));
}
if (isset($_REQUEST['lm_criteria']) && isset($_REQUEST['exact'])) {
    $headerlib = TikiLib::lib('header');
    $headerlib->add_jq_onready("\$('body,html')\n\t\t\t.animate({scrollTop: \$('." . htmlspecialchars($_REQUEST['lm_criteria']) . "')\n\t\t\t\t\t.addClass('ui-state-highlight')\n\t\t\t\t\t.offset().top - 10}, 1);");
}
foreach ($admin_icons as &$admin_icon) {
    $admin_icon = array_merge(array('disabled' => false, 'description' => ''), $admin_icon);
}
// SSL setup
$haveMySQLSSL = $tikilib->haveMySQLSSL();
$smarty->assign('haveMySQLSSL', $haveMySQLSSL);
if ($haveMySQLSSL) {
    $isSSL = $tikilib->isMySQLConnSSL();
} else {
    $isSSL = false;
}
$smarty->assign('mysqlSSL', $isSSL);
$smarty->assign('admin_icons', $admin_icons);
$smarty->assign_by_ref('tikifeedback', $tikifeedback);
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
// Display the template
$smarty->assign('adminpage', $adminPage);
$smarty->assign('mid', 'tiki-admin.tpl');
$smarty->assign('trail', $crumbs);
$smarty->assign('crumb', count($crumbs) - 1);
include_once 'installer/installlib.php';
$installer = new Installer();
$smarty->assign('db_requires_update', $installer->requiresUpdate());
$smarty->display('tiki.tpl');
コード例 #7
0
ファイル: console.php プロジェクト: hurcane/tiki-azure
if (is_file($local_php)) {
    require 'db/tiki-db.php';
    $console->add(new Tiki\Command\InstallCommand());
    $console->add(new Tiki\Command\UpdateCommand());
} else {
    $console->add(new Tiki\Command\UnavailableCommand('database:install'));
    $console->add(new Tiki\Command\UnavailableCommand('database:update'));
}
$installer = $installer = new Installer();
if (is_file($local_php)) {
    require_once 'tiki-setup.php';
    $console->add(new Tiki\Command\CacheClearCommand());
} else {
    $console->add(new Tiki\Command\UnavailableCommand('cache:clear'));
}
if (is_file($local_php) && !$installer->requiresUpdate()) {
    require_once 'tiki-setup.php';
    $console->add(new Tiki\Command\IndexRebuildCommand());
    $console->add(new Tiki\Command\IndexOptimizeCommand());
    $console->add(new Tiki\Command\IndexCatchUpCommand());
    $console->add(new Tiki\Command\ProfileForgetCommand());
    $console->add(new Tiki\Command\ProfileInstallCommand());
    $console->add(new Tiki\Command\ProfileExport\Init());
} else {
    $console->add(new Tiki\Command\UnavailableCommand('index:rebuild'));
    $console->add(new Tiki\Command\UnavailableCommand('index:optimize'));
    $console->add(new Tiki\Command\UnavailableCommand('index:catch-up'));
    $console->add(new Tiki\Command\UnavailableCommand('profile:forget'));
    $console->add(new Tiki\Command\UnavailableCommand('profile:install'));
    $console->add(new Tiki\Command\UnavailableCommand('profile:export:init'));
}