| | 372 | // Initial Database Setup |
| | 373 | |
| | 374 | $tiddlyCfg['db']['type'] = "mysql"; //sql type |
| | 375 | $tiddlyCfg['db']['host'] = "127.0.0.1"; //sql host |
| | 376 | $tiddlyCfg['db']['login'] = "root"; //login name |
| | 377 | $tiddlyCfg['db']['pass'] = ""; //login password |
| | 378 | $tiddlyCfg['db']['name'] = "cct17"; //db name |
| | 379 | $tiddlyCfg['db']['port'] = "3306"; // db port |
| | 380 | |
| | 381 | // User Managment Information |
| | 382 | |
| | 383 | $tiddlyCfg['pref']['delete_other_sessions_on_login'] = 0; // deletes all previous sessions for a user when they login, set to 0 to allow multiple logins. |
| | 384 | $tiddlyCfg['pref']['renew_session_on_each_request'] = 1; // if enabled will renew users session time on each save request |
| | 385 | $tiddlyCfg['users_required_in_db']=0; // users must be in the ccTiddly user database to log in. designed for LDAP and OpenID, if set to 0 users do not need to be in the db |
| | 386 | $tiddlyCfg['can_create_account'] = 1; // users are allowed to register for an account |
| | 387 | |
| | 388 | |
| | 389 | //LDAP |
| | 390 | |
| | 391 | $tiddlyCfg['pref']['ldap_server'] = '127.0.0.1'; |
| | 392 | $tiddlyCfg['pref']['ldap_enabled'] = 1; |
| | 393 | $tiddlyCfg['pref']['ldap_username'] = "CN=Sa063338,OU=functional,OU=btplc,DC=iuser,DC=iroot,DC=adidom,DC=com"; |
| | 394 | $tiddlyCfg['pref']['ldap_password'] = "pass9431w"; |
| | 395 | $tiddlyCfg['pref']['ldap_connection_string'] = "ldap://iuser.iroot.adidom.com:389"; |
| | 396 | |
| | 397 | //Deligated Session Managment |
| | 398 | |
| | 399 | $tiddlyCfg['deligate_session_management'] = 0; |
| | 400 | $tiddlyCfg['pref']['deligate_session_url'] = "http://server..."; |
| | 401 | |
| | 402 | // OpenID |
| | 403 | |
| | 404 | $tiddlyCfg['pref']['openid_enabled'] = 0; // openid not fully implented yet. |
| | 405 | |
| | 406 | // Offline Mode |
| | 407 | // .tiddler and .js files to be loaded from the tiddlers directory when the user is takes ccTiddly in offline mode. |
| | 408 | $tiddlyCfg['pref']['offline']['tiddler'] = |
| | 409 | array( "ccTheme", |
| | 410 | "smmTheme", |
| | 411 | "purpleTheme", |
| | 412 | "taggedTemplateTweak", |
| | 413 | "ValueSwitcherPlugin" |
| | 414 | ); |
| | 415 | |
| | 416 | $tiddlyCfg['pref']['offline']['js'] = |
| | 417 | array( "ccAdaptor" |
| | 418 | ); |
| | 419 | |
| | 420 | //Proxy Allowed Servers |
| | 421 | |
| | 422 | $tiddlyCfg['allowed_proxy_list'] = |
| | 423 | array( 'wikipedia.org', |
| | 424 | 'google.com', |
| | 425 | 'visualtw.ouvaton.org', |
| | 426 | 'en.wikipedia.org', |
| | 427 | 'wikiedia.org', |
| | 428 | 'martinswiki.com', |
| | 429 | 'tiddly-twab.com', |
| | 430 | 'tiddlythemes.com', |
| | 431 | 'tiddlytools.com', |
| | 432 | 'tiddlywiki.org', |
| | 433 | 'osmosoft.com', |
| | 434 | 'wiki.osmosoft.com', |
| | 435 | 'tiddlytools.com', |
| | 436 | 'tiddlythemes.com', |
| | 437 | 'wikidev.osmosoft.com', |
| | 438 | 'itw.bidix.info', |
| | 439 | '127.0.0.1', |
| | 440 | 'localhost', |
| | 441 | 'getteamtasks.com', |
| | 442 | 'mptw.tiddlyspot.com' |
| | 443 | ); |
| | 444 | |
| | 445 | // Allowed file upload types |
| | 446 | |
| | 447 | $tiddlyCfg['upload_allow_extensions'] = |
| | 448 | array( "text/plain", |
| | 449 | "text/xml", |
| | 450 | "text/html", |
| | 451 | "application/msword", |
| | 452 | "application/mspowerpoint", |
| | 453 | "application/excel", |
| | 454 | "application/x-visio", |
| | 455 | "application/pdf", |
| | 456 | "application/octet-stream" |
| | 457 | ); |
| | 458 | |
| | 459 | $tiddlyCfg['max_file_size'] = 9933300000; |
| | 460 | $tiddlyCfg['only_workspace_admin_can_upload'] = 0; //if enabled only the workspace owner will be able to upload files. If disabled (0) any logged in user can upload files. |
| | 461 | |
| | 462 | // Skins and Themes |
| | 463 | |
| | 464 | $tiddlyCfg['workspace_skin'] = 'none'; // allows a workspace to be included when viewing every other workspace on the instance. Set to ='none' if you do not want to use skins |
| | 465 | $tiddlyCfg['txtTheme'] = 'purleTheme'; // The default TiddlyWiki theme to use. |
| | 466 | |
| | 467 | // Debugging Information |
| | 468 | |
| | 469 | $tiddlyCfg['developing'] = 1; //developing mode. If set to 2 will override debug setting below and output everything into the debug file. |
| | 470 | $tiddlyCfg['debug']['mysql'] = 0; // if set to x1 will output every sql query into the logfile |
| | 471 | $tiddlyCfg['debug']['login'] = 1; |
| | 472 | $tiddlyCfg['debug']['handle'] = 0; |
| | 473 | $tiddlyCfg['debug']['config'] = 0; |
| | 474 | $tiddlyCfg['debug']['params'] = 1; |
| | 475 | $tiddlyCfg['debug']['fail'] = 0; |
| | 476 | $tiddlyCfg['debug']['steps'] = 0; |
| | 477 | $tiddlyCfg['debug']['display_logs'] = 0; |
| | 478 | $tiddlyCfg['debug']['secret'] = "bigsecret"; |
| | 479 | |
| | 480 | // Database Tables |
| | 481 | |
| | 482 | $tiddlyCfg['table']['prefix'] = ""; // prefix of table name |
| | 483 | $tiddlyCfg['table']['suffix'] = ""; // suffix of table name |
| | 484 | $tiddlyCfg['table']['main'] = "tiddler"; // name of table for storing tiddlers |
| | 485 | $tiddlyCfg['table']['backup'] = "tiddler_revisions"; // backup/versioned tiddlers |
| | 486 | $tiddlyCfg['table']['workspace'] = "workspace"; // settings for cct |
| | 487 | $tiddlyCfg['table']['user'] = "user"; // username and password |
| | 488 | $tiddlyCfg['table']['group'] = "group_membership"; // group name and membership |
| | 489 | $tiddlyCfg['table']['privilege'] = "privileges"; // privileges |
| | 490 | $tiddlyCfg['table']['admin'] = "admin_of_workspace"; // admin of a particular workspace |
| | 491 | $tiddlyCfg['table']['session'] = "login_session"; // stores login session |
| | 492 | $tiddlyCfg['table']['workspace_view'] = 'workspace_view'; // used to record each viewing of a workspace |
| | 493 | |
| | 494 | // Workspaces |
| | 495 | |
| | 496 | $tiddlyCfg['allow_workspace_creation'] = 1; //0=disable, 1=allow by public, ( 2=allow by user - not implemented yet) |
| | 497 | $tiddlyCfg['create_workspace'] = 1; // allow users to create a workspace |
| | 498 | $tiddlyCfg['GettingStartedText'] = "To get started with this workspace, you'll need to modify the following tiddlers:\n* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)\n* MainMenu: The menu (usually on the left)\n* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the workspace is opened when a user is logged in.\n* AnonDefaultTiddlers: Contains the names of the tiddlers that you want to appear when the worksace is opened when a user who is not logged in. This should contain the login tiddler. [[Login]]\n* You can change the permission of this workspace at anytime by opening the [[Manage Users]] tiddler."; |
| | 499 | // The text that will be displayed to users in the GettingStarted tiddler immediately after they have created a workspace. |
| | 500 | $tiddlyCfg['extract_admin_from_url']=0;// The admin user for each workspace when create will be taken from the URL. If turned on it means the user SimonMcManus owns the workspace /SimonMcManus/. |
| | 501 | $tiddlyCfg['use_mod_rewrite'] = 0; // 1=using mod_rewrite, 0=pass parameter via ?workspace=name |
| | 502 | |
| | 503 | // Other |
| | 504 | |
| | 505 | $tiddlyCfg['twLanguage'] = "en"; //predefine language |
| | 506 | $tiddlyCfg['keep_revision'] = 1; |
| | 507 | $tiddlyCfg['require_login'] = 0; |
| | 508 | |
| | 509 | $tiddlyCfg['tag_tiddler_with_modifier'] = 0; |
| | 510 | $tiddlyCfg['char_set'] = "utf8"; |
| | 511 | $tiddlyCfg['hashseed'] = "aigijgij"; |
| | 512 | $tiddlyCfg['default_anonymous_perm'] = "AUUU"; |
| | 513 | $tiddlyCfg['default_user_perm'] = "AADD"; |
| | 514 | $tiddlyCfg['pref']['utf8'] = 0; |
| | 515 | $tiddlyCfg['on_the_fly_workspace_creation'] = 0; |
| | 516 | |
| | 517 | |
| | 518 | // Nearly depreciated. |
| | 519 | |
| | 520 | $tiddlyCfg['rss_group'] = ""; |
| | 521 | $tiddlyCfg['markup_group'] = ""; |
| | 522 | $tiddlyCfg['tiddlywiki_type'] = "tiddlywiki"; |
| | 523 | $tiddlyCfg['status'] = ""; |
| | 524 | |
| | 525 | // DO NOT EDIT BEYOND THIS POINT |
| | 526 | |
| | 527 | |
| | 528 | /////////////////////////////////////////////////////////url dependent config////////////////////////////////////////////////////. |
| | 529 | |
| | 530 | debug("------------------------------------------------------------------------ >> log breaker << ------------------------------------------------------------------------"); |
| | 531 | debug("QUERY_STRING: ".$_SERVER['QUERY_STRING'], "params"); |
| | 532 | |
| | 533 | $a = str_replace($_SERVER['QUERY_STRING'], "", str_replace(str_replace("index.php", "", $_SERVER['PHP_SELF']), "", $_SERVER['REQUEST_URI'])); |
| | 534 | if (isset($_REQUEST['workspace'])) |
| | 535 | $tiddlyCfg['workspace_name'] = $_REQUEST['workspace']; |
| | 536 | else |
| | 537 | $tiddlyCfg['workspace_name'] = $a; |
| | 538 | if ($b = stristr($tiddlyCfg['workspace_name'], "?")) |
| | 539 | $tiddlyCfg['workspace_name'] = str_replace(stristr($tiddlyCfg['workspace_name'], "?"), "", $b); |
| | 540 | if (isset($_POST['workspace'])) |
| | 541 | $tiddlyCfg['workspace_name'] = $_POST['workspace']; |
| | 542 | |
| | 543 | if($tiddlyCfg['workspace_name'] !="") |
| | 544 | $offline_name = $tiddlyCfg['workspace_name']; |
| | 545 | else |
| | 546 | $offline_name = "default_workspace"; |
| | 547 | |
| | 548 | if (isset($_REQUEST["standalone"]) && $_REQUEST["standalone"]==1) |
| | 549 | header("Content-Disposition: attachment; filename=\"".$offline_name.".html\";\r\n"); |
| | 550 | |
| | 551 | |
| | 552 | debug("workspace_name : ".$tiddlyCfg['workspace_name'], "config"); |
| | 553 | $tiddlyCfg['pref']['base_folder'] = str_replace('/index.php', '', $_SERVER["SCRIPT_NAME"]); |
| | 554 | debug("filename : ".$_SERVER["SCRIPT_NAME"], "config"); |
| | 555 | |
| | 556 | //install new workspace?? |
| | 557 | if (isset($_SERVER['REDIRECT_URL']) ) |
| | 558 | { |
| | 559 | if (stristr($_SERVER['REDIRECT_URL'], 'msghandle.php')) { |
| | 560 | include('./msghandle.php'); |
| | 561 | exit; |
| | 562 | } |
| | 563 | $redirect_url = $_SERVER['REDIRECT_URL']; |
| | 564 | } |
| | 565 | |
| | 566 | $tiddlyCfg['pref']['upload_dir'] = $_SERVER['DOCUMENT_ROOT'].$tiddlyCfg['pref']['base_folder'].'/uploads/'; // location of the file upload directory - assumes is it under the root folder |
| | 567 | if (isset($redirect_url)) |
| | 568 | $file_location = $tiddlyCfg['pref']['upload_dir'].str_replace('/'.$tiddlyCfg['pref']['folder'].'/', '', $redirect_url); // create url to file |
| | 569 | |
| | 570 | if(@file($file_location)) |
| | 571 | { |
| | 572 | readfile($file_location); |
| | 573 | exit; |
| | 574 | } |
| | 575 | |
| | 576 | /////////////////////////////////////////////////////////config dependent include////////////////////////////////////////////////////. |
| | 577 | |
| | 578 | //include_once($cct_base."includes/url.php"); |
| | 579 | include_once($cct_base."includes/db.".$tiddlyCfg['db']['type'].".php"); |
| | 580 | |
| | 581 | |
| | 582 | //////////////////////////////////////////////////////////////////////// manupulate values////////////////////////////////////////////////////. |
| | 583 | |
| | 584 | //////////////////////////////////////////////////////// config file //////////////////////////////////////////////////////// |
| | 585 | //include default config file first before the desired config based either on config variable or URL |
| | 586 | //used for seamless upgrade as possible |
| | 587 | // GLOBAL PREFERENCES THAT PERSIST ACCROSS ALL workspaces |
| | 588 | |
| | 589 | //make connection to DB and select DB name |
| | 590 | db_connect_new(); |
| | 591 | |
| | 592 | //return array form, empty array means workspace not exist |
| | 593 | $workspace_settings = db_workspace_selectSettings(); |
| | 594 | |
| | 595 | //if no instance found, check if instance name is empty string |
| | 596 | if( sizeof($workspace_settings)==0 ) |
| | 597 | { |
| | 598 | if( strlen($tiddlyCfg['workspace_name'])==0 ) |
| | 599 | {//do install |
| | 600 | include_once($cct_base."includes/workspace.php"); |
| | 601 | workspace_create_new(); |
| | 602 | }else{ //if not empty, check if installation can be done |
| | 603 | if( $tiddlyCfg['allow_workspace_creation']>0 ) |
| | 604 | {//if allow workspace creation |
| | 605 | |
| | 606 | if ($_POST) |
| | 607 | { |
| | 608 | include($cct_base."includes/workspace.php"); |
| | 609 | workspace_create($tiddlyCfg['workspace_name'], $_POST['ccAnonPerm']); |
| | 610 | } |
| | 611 | |
| | 612 | if( $tiddlyCfg['allow_workspace_creation']==2 ) //if =2, only allow user to create workspace |
| | 613 | { |
| | 614 | //check if user login valid |
| | 615 | } |
| | 616 | //db_workspace_install($tiddlyCfg); //install using default parameters |
| | 617 | }else{ //give error message of workspace not found |
| | 618 | header("HTTP/1.0 404 Not Found"); |
| | 619 | exit($ccT_msg['error']['workspace_not_found']); |
| | 620 | } |
| | 621 | } |
| | 622 | } |
| | 623 | $tiddlyCfg = array_merge($tiddlyCfg, $workspace_settings); |
| | 624 | |
| | 625 | $tiddlyCfg['pref']['lock_title'] = array("LoginPanel"); //lock certain tiddler's title such that it can't be changed even with admin |
| | 626 | $tiddlyCfg['pref']['uploadPluginIgnoreTitle'] = array("ccTiddly_debug_time", "UploadLog","UploadPlugin","UploadOptions"); //this specify what tiddler should uploadplugin ignore. It is recommended to put in uploadPlugin itself and the upload log. CaSe-SeNsItIvE |
| | 627 | $tiddlyCfg['pref']['forceAnonymous'] = 1; //if enabled, anonymous users will take "anonymous" as username |
| | 628 | $tiddlyCfg['pref']['hashSeed'] = "145tgwg45wg4"; //used to increase security for hashing passwords. Put in a random string withing the double quotes. |
| | 629 | $tiddlyCfg['session_expire']=120;// in minutes - If set to 0 will not expire |
| | 630 | /* |
| | 631 | This specify whether utf8 is required [1 = enable, 0 =disable] |
| | 632 | If you got one of the following error message, that may mean your database do not support utf8 |
| | 633 | during upgrade: |
| | 634 | Query: ALTER TABLE <table name> DEFAULT CHARACTER SET utf8 COLLATE |
| | 635 | during regular running: |
| | 636 | Error Query: SET NAMES 'utf8' |
| | 637 | */ |
| | 638 | $tiddlyCfg['pref']['utf8'] = 0; |
| | 639 | |
| | 640 | ////////////////////////////////////////////////////users and privileges//////////////////////////////////////////////////// |
| | 641 | |
| | 642 | |
| | 643 | $admin_select_data['workspace_name'] = $tiddlyCfg['workspace_name']; |
| | 644 | $results = db_record_select($tiddlyCfg['table']['admin'], $admin_select_data);// get list of admin users for workspace |
| | 645 | |
| | 646 | $i = 0; |
| | 647 | foreach($results as $result) |
| | 648 | $admin_array[$i++] = $result['username']; |
| | 649 | |
| | 650 | if(is_array($admin_array)) |
| | 651 | $tiddlyCfg['group']['admin'] = $admin_array; |
| | 652 | else |
| | 653 | $tiddlyCfg['group']['admin'] = array(); |
| | 654 | |
| | 655 | $tiddlyCfg['group']['exampleGroup'] = array('admin', 'simon'); |
| | 656 | |
| | 657 | //user allow to upload rss, put in group names here like $tiddlyCfg['privilege_misc']['rss'] = array("<group1>", "<group2>"); |
| | 658 | $tiddlyCfg['privilege_misc']['rss'] = array("user"); |
| | 659 | $tiddlyCfg['privilege_misc']['upload'] = array("admin"); //user allow to upload the whole TW or import TW, put in group names here |
| | 660 | $tiddlyCfg['privilege_misc']['markup'] = array("admin"); //user allow to change markup |
| | 661 | |
| | 662 | /* PRIVILEGE SYSTEM |
| | 663 | |
| | 664 | The privilege system consist of four character, each represent a different action |
| | 665 | |
| | 666 | privilege order |
| | 667 | read/insert/edit/delete |
| | 668 | |
| | 669 | privilege value |
| | 670 | Allow (A) |
| | 671 | Deny (D) |
| | 672 | Undefine/Unchange (U) |
| | 673 | |
| | 674 | Example : |
| | 675 | |
| | 676 | for a privilege string "ADAU", the privilege for a particular tiddler to the user would be |
| | 677 | R READ: allowed the user is allowed to read |
| | 678 | C INSERT: deny the user is NOT allowed to insert a tiddler with a certain tag |
| | 679 | U EDIT: allowed the user is allow to edit the tiddler |
| | 680 | D DELETE: undefined undefined privilege. This would be replaced by either allowed or deny depending on the config "undefined_privilege" |
| | 681 | |
| | 682 | Notes : |
| | 683 | |
| | 684 | * UNDEFINED (normally treated as DENY, see settings below) can be overwrited by ALLOW |
| | 685 | * DENY has the highest priority and could not be overwrite by ALLOW/UNDEFINED |
| | 686 | * If a tiddler has several tag, of which one has deny in one of the privilege, it would be treated as deny on that privilege |
| | 687 | * Rename a tiddler requires EDIT privilege |
| | 688 | * Overwrite one tiddler with new tiddler requires EDIT privilege |
| | 689 | * Overwrite a tiddler(A) with another tiddler(B) require DELETE privilege for tiddler (A) , and EDIT for the overwritting tiddler (B) |
| | 690 | |
| | 691 | */ |
| | 692 | |
| | 693 | //default privileges |
| | 694 | $tiddlyCfg['privilege_misc']['undefined_privilege'] = "A"; //defined what should undefined (U) be treated as |
| | 695 | $tiddlyCfg['privilege_misc']['default_privilege'] = "AAAA"; //default privilege for all group and tags |
| | 696 | //default privileges for certain groups, applied after default_privilege |
| | 697 | // it is in the form: $tiddlyCfg['privilege_misc']['group_default_privilege']['<group name>'] |
| | 698 | $tiddlyCfg['privilege_misc']['group_default_privilege']['anonymous'] = "ADDD"; |
| | 699 | $tiddlyCfg['privilege_misc']['group_default_privilege']['non_admin'] = "AAAA"; |
| | 700 | $tiddlyCfg['privilege_misc']['group_default_privilege']['admin'] = "AAAA"; |
| | 701 | ////////////////////////////////////////////////////////ADVANCE PRIVILEGE for tags////////////////////////////////////////////////////// |
| | 702 | /* |
| | 703 | assign privilege to specific tag using groups |
| | 704 | this is of the format |
| | 705 | $tiddlyCfg['privilege']['<put your group name here>']['<put your tag name here>'] = "<put your privilege here>"; |
| | 706 | EXAMPLE: this would deny anonymous users to insert/edit/delete systemConfig tags but still allow it to run |
| | 707 | $tiddlyCfg['privilege']['anonymous']['systemConfig'] = "ADDD"; |
| | 708 | */ |
| | 709 | |
| | 710 | $tiddlyCfg['privilege']['admin']['systemConfig'] = "AAAA"; |
| | 711 | $tiddlyCfg['privilege']['user']['task'] = "AAAA"; |
| | 712 | $tiddlyCfg['privilege']['anonymous']['task'] = "DDDD"; |
| | 713 | $tiddlyCfg['privilege']['admin']['task'] = "AAAA"; |
| | 714 | //The following privilege are for blog |
| | 715 | |
| | 716 | $tiddlyCfg['privilege']['anonymous']['private'] = "DDDD"; |
| | 717 | $tiddlyCfg['privilege']['anonymous']['comments'] = "AADD"; //allow comments to be post anonymously |
| | 718 | |
| | 719 | // END OF PERMISSIONS |
| | 720 | |
| | 721 | $tiddlyCfg['version']="1.7"; //set ccTiddly Version number |
| | 722 | $tiddlyCfg['session_expire'] = ($tiddlyCfg['session_expire']==0?9999999:$tiddlyCfg['session_expire']); |
| | 723 | $tiddlyCfg['session_expire'] = $tiddlyCfg['session_expire'] * 60; // Converts minutes to seconds to be added to an epoch value |
| | 724 | |
| | 725 | $tiddlyCfg['table']['main'] = $tiddlyCfg['table']['prefix'].$tiddlyCfg['table']['main'].$tiddlyCfg['table']['suffix']; |
| | 726 | $tiddlyCfg['table']['backup'] = $tiddlyCfg['table']['prefix'].$tiddlyCfg['table']['backup'].$tiddlyCfg['table']['suffix']; |
| | 727 | $tiddlyCfg['table']['user'] = $tiddlyCfg['table']['prefix'].$tiddlyCfg['table']['user'].$tiddlyCfg['table']['suffix']; |
| | 728 | $tiddlyCfg['table']['group'] = $tiddlyCfg['table']['prefix'].$tiddlyCfg['table']['group'].$tiddlyCfg['table']['suffix']; |
| | 729 | $tiddlyCfg['table']['privilege'] = $tiddlyCfg['table']['prefix'].$tiddlyCfg['table']['privilege'].$tiddlyCfg['table']['suffix']; |
| | 730 | $tiddlyCfg['tiddlywiki_type'] = $cct_base."tiddlywiki/".$tiddlyCfg['tiddlywiki_type'].".js"; // plain TW file, $cct_base defined in config.php |
| | 731 | |
| | 732 | if ($tiddlyCfg['debug']['params']==1 || $tiddlyCfg['developing'] == 2 ) |
| | 733 | { |
| | 734 | foreach ($_POST as $k => $v) { |
| | 735 | debug("POST : ".$k." : ".$v, "params"); |
| | 736 | } |
| | 737 | foreach ($_REQUEST as $k => $v) { |
| | 738 | // debug("REQUEST : ".$k." : ".$v, "params"); |
| | 739 | } |
| | 740 | } |
| | 741 | |