| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      /**
 
     | 
  
  
    | 
      3
     | 
    
       *
 
     | 
  
  
    | 
      4
     | 
    
       * @category        admin
 
     | 
  
  
    | 
      5
     | 
    
       * @package         modules
 
     | 
  
  
    | 
      6
     | 
    
       * @author          Ryan Djurovich, WebsiteBaker Project
 
     | 
  
  
    | 
      7
     | 
    
       * @copyright       2009-2013, WebsiteBaker Org. e.V.
 
     | 
  
  
    | 
      8
     | 
    
       * @link            http://www.websitebaker.org/
 
     | 
  
  
    | 
      9
     | 
    
       * @license         http://www.gnu.org/licenses/gpl.html
 
     | 
  
  
    | 
      10
     | 
    
       * @platform        WebsiteBaker 2.8.x
 
     | 
  
  
    | 
      11
     | 
    
       * @requirements    PHP 5.2.2 and higher
 
     | 
  
  
    | 
      12
     | 
    
       * @version         $Id: details.php 2098 2014-02-11 01:37:03Z darkviper $
 
     | 
  
  
    | 
      13
     | 
    
       * @filesource      $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/modules/details.php $
 
     | 
  
  
    | 
      14
     | 
    
       * @lastmodified    $Date: 2014-02-11 02:37:03 +0100 (Tue, 11 Feb 2014) $
 
     | 
  
  
    | 
      15
     | 
    
       *
 
     | 
  
  
    | 
      16
     | 
    
       */
 
     | 
  
  
    | 
      17
     | 
    
      
 
     | 
  
  
    | 
      18
     | 
    
      // Include the config file
 
     | 
  
  
    | 
      19
     | 
    
      require('../../config.php');
     | 
  
  
    | 
      20
     | 
    
      $oTrans = Translate::getInstance();
 
     | 
  
  
    | 
      21
     | 
    
      $oTrans->enableAddon('admin\\modules');
     | 
  
  
    | 
      22
     | 
    
      require_once(WB_PATH .'/framework/functions.php');
 
     | 
  
  
    | 
      23
     | 
    
      require_once(WB_PATH.'/framework/class.admin.php');
 
     | 
  
  
    | 
      24
     | 
    
      // No print admin header
 
     | 
  
  
    | 
      25
     | 
    
      $admin = new admin('Addons', 'modules_view', false);
     | 
  
  
    | 
      26
     | 
    
      if( !$admin->checkFTAN() )
 
     | 
  
  
    | 
      27
     | 
    
      {
     | 
  
  
    | 
      28
     | 
    
      	$admin->print_header();
 
     | 
  
  
    | 
      29
     | 
    
      	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS);
 
     | 
  
  
    | 
      30
     | 
    
      }
 
     | 
  
  
    | 
      31
     | 
    
      // After check print the header
 
     | 
  
  
    | 
      32
     | 
    
      $admin->print_header();
 
     | 
  
  
    | 
      33
     | 
    
      
 
     | 
  
  
    | 
      34
     | 
    
      if(!isset($_POST['file']) OR $_POST['file'] == "") {
     | 
  
  
    | 
      35
     | 
    
      	$admin->print_error($oTrans->MESSAGE_GENERIC_FORGOT_OPTIONS);
 
     | 
  
  
    | 
      36
     | 
    
      } else {
     | 
  
  
    | 
      37
     | 
    
      	$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']);  // fix secunia 2010-92-2
     | 
  
  
    | 
      38
     | 
    
      }
 
     | 
  
  
    | 
      39
     | 
    
      
 
     | 
  
  
    | 
      40
     | 
    
      // Check if the template exists
 
     | 
  
  
    | 
      41
     | 
    
      if(!is_dir(WB_PATH.'/modules/'.$file)) {
     | 
  
  
    | 
      42
     | 
    
      	$admin->print_error($file.'::'.$oTrans->MESSAGE_GENERIC_NOT_INSTALLED);
 
     | 
  
  
    | 
      43
     | 
    
      }
 
     | 
  
  
    | 
      44
     | 
    
      
 
     | 
  
  
    | 
      45
     | 
    
      // Check if the template exists
 
     | 
  
  
    | 
      46
     | 
    
      if(!is_readable(WB_PATH.'/modules/'.$file)) {
     | 
  
  
    | 
      47
     | 
    
      	$admin->print_error($oTrans->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES);
 
     | 
  
  
    | 
      48
     | 
    
      }
 
     | 
  
  
    | 
      49
     | 
    
      // Setup template object, parse vars to it, then parse it
 
     | 
  
  
    | 
      50
     | 
    
      // Create new template object
 
     | 
  
  
    | 
      51
     | 
    
      $template = new Template(dirname($admin->correct_theme_source('modules_details.htt')),'keep');
     | 
  
  
    | 
      52
     | 
    
      // $template->debug = true;
 
     | 
  
  
    | 
      53
     | 
    
      $template->set_file('page', 'modules_details.htt');
     | 
  
  
    | 
      54
     | 
    
      $template->set_block('page', 'main_block', 'main');
     | 
  
  
    | 
      55
     | 
    
      $template->set_var($oTrans->getLangArray());
 
     | 
  
  
    | 
      56
     | 
    
      // Insert values
 
     | 
  
  
    | 
      57
     | 
    
      $module = false;
 
     | 
  
  
    | 
      58
     | 
    
      $sql = 'SELECT * FROM  `'.TABLE_PREFIX.'addons` '
 
     | 
  
  
    | 
      59
     | 
    
           . 'WHERE `type` = \'module\' '
 
     | 
  
  
    | 
      60
     | 
    
           . 'AND `directory`= \''.$file.'\' ';
 
     | 
  
  
    | 
      61
     | 
    
      if( ($result = $database->query($sql)) ){
     | 
  
  
    | 
      62
     | 
    
      	$module = $result->fetchRow(MYSQL_ASSOC);
 
     | 
  
  
    | 
      63
     | 
    
      }
 
     | 
  
  
    | 
      64
     | 
    
      if(!$module) { $admin->print_error($oTrans->MESSAGE_GENERIC_NOT_INSTALLED); }
     | 
  
  
    | 
      65
     | 
    
      /*-- insert all needed vars from language files ----------------------------------------*/
 
     | 
  
  
    | 
      66
     | 
    
      $template->set_var($oTrans->getLangArray());
 
     | 
  
  
    | 
      67
     | 
    
      
 
     | 
  
  
    | 
      68
     | 
    
      // check if a module description exists for the displayed backend language
 
     | 
  
  
    | 
      69
     | 
    
      $tool_description = false;
 
     | 
  
  
    | 
      70
     | 
    
      if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$file.'/languages/'.LANGUAGE .'.php')) {
     | 
  
  
    | 
      71
     | 
    
      	// read contents of the module language file into string
 
     | 
  
  
    | 
      72
     | 
    
      	$data = @file_get_contents(WB_PATH .'/modules/' .$file .'/languages/' .LANGUAGE .'.php');
 
     | 
  
  
    | 
      73
     | 
    
      	// use regular expressions to fetch the content of the variable from the string
 
     | 
  
  
    | 
      74
     | 
    
      	$tool_description = get_variable_content('module_description', $data, false, false);
     | 
  
  
    | 
      75
     | 
    
      	// replace optional placeholder {WB_URL} with value stored in config.php
     | 
  
  
    | 
      76
     | 
    
      	if($tool_description !== false && strlen(trim($tool_description)) != 0) {
     | 
  
  
    | 
      77
     | 
    
      		$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
     | 
  
  
    | 
      78
     | 
    
      	} else {
     | 
  
  
    | 
      79
     | 
    
      		$tool_description = false;
 
     | 
  
  
    | 
      80
     | 
    
      	}
 
     | 
  
  
    | 
      81
     | 
    
      }
 
     | 
  
  
    | 
      82
     | 
    
      if($tool_description !== false) {
     | 
  
  
    | 
      83
     | 
    
      	// Override the module-description with correct desription in users language
 
     | 
  
  
    | 
      84
     | 
    
      	$module['description'] = $tool_description;
 
     | 
  
  
    | 
      85
     | 
    
      }
 
     | 
  
  
    | 
      86
     | 
    
      
 
     | 
  
  
    | 
      87
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      88
     | 
    
      								'NAME' => $module['name'],
 
     | 
  
  
    | 
      89
     | 
    
      								'AUTHOR' => $module['author'],
 
     | 
  
  
    | 
      90
     | 
    
      								'DESCRIPTION' => $module['description'],
 
     | 
  
  
    | 
      91
     | 
    
      								'VERSION' => $module['version'],
 
     | 
  
  
    | 
      92
     | 
    
      								'DESIGNED_FOR' => $module['platform'],
 
     | 
  
  
    | 
      93
     | 
    
      								'ADMIN_URL' => ADMIN_URL,
 
     | 
  
  
    | 
      94
     | 
    
      								'WB_URL' => WB_URL,
 
     | 
  
  
    | 
      95
     | 
    
      								'THEME_URL' => THEME_URL
 
     | 
  
  
    | 
      96
     | 
    
      								)
 
     | 
  
  
    | 
      97
     | 
    
      						);
 
     | 
  
  
    | 
      98
     | 
    
      
 
     | 
  
  
    | 
      99
     | 
    
      switch ($module['function']) {
     | 
  
  
    | 
      100
     | 
    
      	case NULL:
 
     | 
  
  
    | 
      101
     | 
    
      		$type_name = $oTrans->TEXT_UNKNOWN;
 
     | 
  
  
    | 
      102
     | 
    
      		break;
 
     | 
  
  
    | 
      103
     | 
    
      	case 'page':
 
     | 
  
  
    | 
      104
     | 
    
      		$type_name = $oTrans->TEXT_PAGE;
 
     | 
  
  
    | 
      105
     | 
    
      		break;
 
     | 
  
  
    | 
      106
     | 
    
      	case 'wysiwyg':
 
     | 
  
  
    | 
      107
     | 
    
      		$type_name = $oTrans->TEXT_WYSIWYG_EDITOR;
 
     | 
  
  
    | 
      108
     | 
    
      		break;
 
     | 
  
  
    | 
      109
     | 
    
      	case 'tool':
 
     | 
  
  
    | 
      110
     | 
    
      		$type_name = $oTrans->TEXT_ADMINISTRATION_TOOL;
 
     | 
  
  
    | 
      111
     | 
    
      		break;
 
     | 
  
  
    | 
      112
     | 
    
      	case 'admin':
 
     | 
  
  
    | 
      113
     | 
    
      		$type_name = $oTrans->TEXT_ADMIN;
 
     | 
  
  
    | 
      114
     | 
    
      		break;
 
     | 
  
  
    | 
      115
     | 
    
      	case 'administration':
 
     | 
  
  
    | 
      116
     | 
    
      		$type_name = $oTrans->TEXT_ADMINISTRATION;
 
     | 
  
  
    | 
      117
     | 
    
      		break;
 
     | 
  
  
    | 
      118
     | 
    
      	case 'snippet':
 
     | 
  
  
    | 
      119
     | 
    
      		$type_name = $oTrans->TEXT_CODE_SNIPPET;
 
     | 
  
  
    | 
      120
     | 
    
      		break;
 
     | 
  
  
    | 
      121
     | 
    
      	default:
 
     | 
  
  
    | 
      122
     | 
    
      		$type_name = $oTrans->TEXT_UNKNOWN;
 
     | 
  
  
    | 
      123
     | 
    
      }
 
     | 
  
  
    | 
      124
     | 
    
      $template->set_var('TYPE', $type_name);
     | 
  
  
    | 
      125
     | 
    
      
 
     | 
  
  
    | 
      126
     | 
    
      
 
     | 
  
  
    | 
      127
     | 
    
      // Parse module object
 
     | 
  
  
    | 
      128
     | 
    
      $template->parse('main', 'main_block', false);
     | 
  
  
    | 
      129
     | 
    
      $template->pparse('output', 'page');
     | 
  
  
    | 
      130
     | 
    
      // Print admin footer
 
     | 
  
  
    | 
      131
     | 
    
      $admin->print_footer();
 
     |