Example #1
0
 function input()
 {
     $logs = array();
     foreach (TikiLib::lib('logsqry')->listTypes() as $type) {
         $logs[] = array("label" => tr(ucwords($type)), "value" => $type);
     }
     $actions = array(array("label" => tr("All"), "value" => ""));
     foreach (TikiLib::lib('logsqry')->listActions() as $action) {
         $actions[] = array("label" => tr(ucwords($action)), "value" => $action);
     }
     $fields = array();
     foreach (TikiLib::fetchAll("SHOW COLUMNS FROM tiki_actionlog") as $column) {
         $fields[] = array("label" => tr(ucwords($column['Field'])), "value" => $column['Field']);
     }
     return array("values" => array("logs" => $logs, "actions" => $actions, "fields" => $fields, "grouping" => array(array("label" => tr("None"), "value" => ""), array("label" => tr("Count"), "value" => "count"), array("label" => tr("Count By Date"), "value" => "countByDate"), array("label" => tr("Count By Date Filter Id"), "value" => "countByDateFilterId"), array("label" => tr("Count Users Filter Id"), "value" => "countUsersFilterId"), array("label" => tr("Count Users IP Filter Id"), "value" => "countUsersIPFilterId")), "sort" => array(array("label" => tr("None"), "value" => ""), array("label" => tr("Ascending By Date"), "value" => "asc"), array("label" => tr("Descending By Date"), "value" => "desc"))), "options" => array(array("label" => tr("Logs"), "key" => "logs", "type" => "single", "values" => "logs", "repeats" => false, "options" => array(array("label" => tr("Action"), "key" => "action", "type" => "single", "values" => "actions", "repeats" => false), array("label" => tr("Start"), "key" => "start", "type" => "date", "repeats" => false), array("label" => tr("End"), "key" => "end", "type" => "date", "repeats" => false), array("label" => tr("Fields"), "key" => "fields", "type" => "multi", "values" => "fields", "repeats" => false), array("label" => tr("Grouping"), "key" => "grouping", "type" => "single", "values" => "grouping"), array("label" => tr("Sort"), "key" => "sort", "type" => "single", "values" => "sort"), array("label" => tr("Limit"), "key" => "limit", "type" => "single")))));
 }
Example #2
0
 static function newestWikiRevision($phrase, $page)
 {
     $match = -1;
     $i = 0;
     $page = end(TikiLib::fetchAll("SELECT data, version FROM tiki_pages WHERE pageName = ?", array($page)));
     $page['data'] = TikiLib::lib("parser")->parse_data($page['data']);
     $match = JisonParser_Phraser_Handler::hasPhrase($page['data'], $phrase) == true ? $page['version'] : -1;
     if ($match < 0) {
         foreach (TikiLib::fetchAll("SELECT data, version FROM tiki_history WHERE pageName = ? ORDER BY version DESC", array($page)) as $page) {
             $match = JisonParser_Phraser_Handler::hasPhrase($page['data'], $phrase) == true ? $page['version'] : -1;
             if ($match > -1) {
                 break;
             }
         }
     }
     return (int) $match;
 }
Example #3
0
<?php

// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: backup.php 44444 2013-01-05 21:24:24Z changi67 $
require_once 'tiki-setup.php';
$access->check_permission('tiki_p_admin');
$backup = "";
foreach (TikiLib::fetchAll('SHOW TABLES') as $table) {
    $table = end($table);
    $result = TikiLib::fetchAll('SELECT * FROM ' . $table);
    $num_fields = count($result);
    $backup .= 'DROP TABLE ' . $table . ';';
    $createTable = TikiLib::fetchAll('SHOW CREATE TABLE ' . $table);
    $backup .= "\n\n" . $createTable[0]['Create Table'] . ";\n\n";
    foreach ($result as $row) {
        $fields = array();
        foreach ($row as $field) {
            $field = addslashes($field);
            $field = preg_replace("\n", "\\n", $field);
            $fields[] = isset($field) ? '"' . $field . '"' : '""';
        }
        $backup .= 'INSERT INTO ' . $table . ' VALUES(' . implode(",", $fields) . ');' . "\n";
    }
    $backup .= "\n\n\n";
}
//save file
$handle = fopen('temp/db-backup-' . time() . '-' . md5(implode(',', $tables)) . '.sql', 'w+');
fwrite($handle, $backup);