Esempio n. 1
0
 function getAccesses()
 {
     global $toC_Json, $osC_Language;
     $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/access');
     $osC_DirectoryListing->setIncludeDirectories(false);
     $access_modules_array = array();
     foreach ($osC_DirectoryListing->getFiles() as $file) {
         $module = substr($file['name'], 0, strrpos($file['name'], '.'));
         if (!class_exists('osC_Access_' . ucfirst($module))) {
             $osC_Language->loadIniFile('modules/access/' . $file['name']);
             include $osC_DirectoryListing->getDirectory() . '/' . $file['name'];
         }
         $module = 'osC_Access_' . ucfirst($module);
         $module = new $module();
         $title = osC_Access::getGroupTitle($module->getGroup());
         $access_modules_array[$title][] = array('id' => $module->getModule(), 'text' => $module->getTitle(), 'leaf' => true);
     }
     ksort($access_modules_array);
     $access_options = array();
     $count = 1;
     foreach ($access_modules_array as $group => $modules) {
         $access_option['id'] = $count;
         $access_option['text'] = $group;
         $mod_arrs = array();
         foreach ($modules as $module) {
             $mod_arrs[] = $module;
         }
         $access_option['children'] = $mod_arrs;
         $access_options[] = $access_option;
         $count++;
     }
     echo $toC_Json->encode($access_options);
 }
Esempio n. 2
0
 function listDirectory()
 {
     global $osC_Language, $toC_Json, $osC_MessageStack;
     $directory = OSC_ADMIN_FILE_MANAGER_ROOT_PATH;
     if (isset($_REQUEST['directory']) && !empty($_REQUEST['directory'])) {
         $directory .= '/' . urldecode($_REQUEST['directory']);
     } elseif (isset($_REQUEST['goto']) && !empty($_REQUEST['goto'])) {
         $directory .= '/' . urldecode($_REQUEST['goto']);
     }
     $osC_DirectoryListing = new osC_DirectoryListing($directory);
     $osC_DirectoryListing->setStats(true);
     $records = array();
     foreach ($osC_DirectoryListing->getFiles() as $file) {
         $file_owner = function_exists('posix_getpwuid') ? posix_getpwuid($file['user_id']) : '-?-';
         $group_owner = function_exists('posix_getgrgid') ? posix_getgrgid($file['group_id']) : '-?-';
         if ($file['is_directory'] === true) {
             $entry_icon = osc_icon('folder_red.png');
             $action = array(array('class' => 'icon-empty-record', 'qtip' => ''), array('class' => 'icon-empty-record', 'qtip' => ''), array('class' => 'icon-delete-record', 'qtip' => $osC_Language->get('icon_trash')));
         } else {
             $entry_icon = osc_icon('file.png');
             $action = array(array('class' => 'icon-edit-record', 'qtip' => $osC_Language->get('icon_edit')), array('class' => 'icon-download-record', 'qtip' => $osC_Language->get('icon_download')), array('class' => 'icon-delete-record', 'qtip' => $osC_Language->get('icon_trash')));
         }
         $records[] = array('icon' => $entry_icon, 'file_name' => $file['name'], 'is_directory' => $file['is_directory'], 'size' => number_format($file['size']), 'permission' => osc_get_file_permissions($file['permissions']), 'file_owner' => $file_owner, 'group_owner' => $group_owner, 'writeable' => osc_icon(is_writable($osC_DirectoryListing->getDirectory() . '/' . $file['name']) ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif'), 'last_modified_date' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($file['last_modified']), true), 'action' => $action);
     }
     $response = array(EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Esempio n. 3
0
 public static function getAccessModules()
 {
     global $osC_Language;
     $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/access');
     $osC_DirectoryListing->setIncludeDirectories(false);
     $modules = array();
     foreach ($osC_DirectoryListing->getFiles() as $file) {
         $module = substr($file['name'], 0, strrpos($file['name'], '.'));
         if (!class_exists('osC_Access_' . ucfirst($module))) {
             $osC_Language->loadIniFile('modules/access/' . $file['name']);
             include $osC_DirectoryListing->getDirectory() . '/' . $file['name'];
         }
         $module = 'osC_Access_' . ucfirst($module);
         $module = new $module();
         $modules[osC_Access::getGroupTitle($module->getGroup())][] = array('id' => $module->getModule(), 'text' => $module->getTitle());
     }
     ksort($modules);
     return $modules;
 }
Esempio n. 4
0
    ?>
</td>
      <td align="center"><tt><?php 
    echo osc_get_file_permissions($file['permissions']);
    ?>
</tt></td>
      <td><?php 
    echo $file_owner['name'];
    ?>
</td>
      <td><?php 
    echo $group_owner['name'];
    ?>
</td>
      <td align="center"><?php 
    echo osc_icon(is_writable($osC_DirectoryListing->getDirectory() . '/' . $file['name']) ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif', null, null);
    ?>
</td>
      <td align="right"><?php 
    echo date('F d Y H:i:s', $file['last_modified']);
    ?>
</td>
      <td align="right">

<?php 
    if ($file['is_directory'] === false) {
        echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&entry=' . $file['name'] . '&action=save'), osc_icon('edit.png')) . '&nbsp;' . osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&entry=' . $file['name'] . '&action=download'), osc_icon('save.png')) . '&nbsp;';
    } else {
        echo osc_image('images/pixel_trans.gif') . '&nbsp;' . osc_image('images/pixel_trans.gif') . '&nbsp;';
    }
    echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&entry=' . $file['name'] . '&action=delete'), osc_icon('trash.png'));
Esempio n. 5
0
$http_catalog = $http_url['path'];
if (isset($http_url['port']) && !empty($http_url['port'])) {
    $http_server .= ':' . $http_url['port'];
}
if (substr($http_catalog, -1) != '/') {
    $http_catalog .= '/';
}
$http_work_directory = $_POST['HTTP_WORK_DIRECTORY'];
if (substr($http_work_directory, -1) != '/') {
    $http_work_directory .= '/';
}
$osC_DirectoryListing = new osC_DirectoryListing($http_work_directory);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('cache');
foreach ($osC_DirectoryListing->getFiles() as $files) {
    @unlink($osC_DirectoryListing->getDirectory() . '/' . $files['name']);
}
$file_contents = '<?php' . "\n" . '  define(\'HTTP_SERVER\', \'' . $http_server . '\');' . "\n" . '  define(\'HTTPS_SERVER\', \'' . $http_server . '\');' . "\n" . '  define(\'ENABLE_SSL\', false);' . "\n" . '  define(\'HTTP_COOKIE_DOMAIN\', \'' . $http_url['host'] . '\');' . "\n" . '  define(\'HTTPS_COOKIE_DOMAIN\', \'' . $http_url['host'] . '\');' . "\n" . '  define(\'HTTP_COOKIE_PATH\', \'' . $http_catalog . '\');' . "\n" . '  define(\'HTTPS_COOKIE_PATH\', \'' . $http_catalog . '\');' . "\n" . '  define(\'DIR_WS_HTTP_CATALOG\', \'' . $http_catalog . '\');' . "\n" . '  define(\'DIR_WS_HTTPS_CATALOG\', \'' . $http_catalog . '\');' . "\n" . '  define(\'DIR_WS_IMAGES\', \'images/\');' . "\n\n" . '  define(\'DIR_WS_DOWNLOAD_PUBLIC\', \'pub/\');' . "\n" . '  define(\'DIR_FS_CATALOG\', \'' . $dir_fs_document_root . '\');' . "\n" . '  define(\'DIR_FS_ADMIN\', \'admin/\');' . "\n" . '  define(\'DIR_FS_WORK\', \'' . $http_work_directory . '\');' . "\n" . '  define(\'DIR_FS_DOWNLOAD\', DIR_FS_CATALOG . \'download/\');' . "\n" . '  define(\'DIR_FS_DOWNLOAD_PUBLIC\', DIR_FS_CATALOG . \'pub/\');' . "\n" . '  define(\'DIR_FS_BACKUP\', \'' . $dir_fs_document_root . '\' . DIR_FS_ADMIN . \'backups/\');' . "\n" . '  define(\'DIR_FS_CACHE\', DIR_FS_CATALOG . \'cache/\');' . "\n" . '  define(\'DIR_FS_CACHE_ADMIN\', DIR_FS_CACHE . DIR_FS_ADMIN);' . "\n\n" . '  define(\'DB_SERVER\', \'' . $_POST['DB_SERVER'] . '\');' . "\n" . '  define(\'DB_SERVER_USERNAME\', \'' . $_POST['DB_SERVER_USERNAME'] . '\');' . "\n" . '  define(\'DB_SERVER_PASSWORD\', \'' . $_POST['DB_SERVER_PASSWORD'] . '\');' . "\n" . '  define(\'DB_DATABASE\', \'' . $_POST['DB_DATABASE'] . '\');' . "\n" . '  define(\'DB_DATABASE_CLASS\', \'' . $_POST['DB_DATABASE_CLASS'] . '\');' . "\n" . '  define(\'DB_TABLE_PREFIX\', \'' . $_POST['DB_TABLE_PREFIX'] . '\');' . "\n" . '  define(\'USE_PCONNECT\', \'false\');' . "\n" . '  define(\'STORE_SESSIONS\', \'mysql\');' . "\n" . '?>';
if (file_exists($dir_fs_document_root . 'includes/configure.php') && !is_writeable($dir_fs_document_root . 'includes/configure.php')) {
    @chmod($dir_fs_document_root . 'includes/configure.php', 0777);
}
if (file_exists($dir_fs_document_root . 'includes/configure.php') && is_writeable($dir_fs_document_root . 'includes/configure.php')) {
    $fp = fopen($dir_fs_document_root . 'includes/configure.php', 'w');
    fputs($fp, $file_contents);
    fclose($fp);
} else {
    ?>

    <form name="install" action="index.php?step=6" method="post">

    <div class="noticeBox">
Esempio n. 6
0
        } else {
            echo osc_image('images/pixel_trans.gif', '', '16', '16') . '&nbsp;' . osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&set=' . $_GET['set'] . '&module=' . $code . '&action=install'), osc_icon('install.png')) . '&nbsp;';
        }
        echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&set=' . $_GET['set'] . '&module=' . $code . '&action=info'), osc_icon('info.png'));
        ?>

      </td>
    </tr>

<?php 
    }
}
?>

  </tbody>
</table>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td style="opacity: 0.5; filter: alpha(opacity=50);"><?php 
echo '<b>' . $osC_Language->get('table_action_legend') . '</b> ' . osc_icon('edit.png') . '&nbsp;' . $osC_Language->get('icon_edit') . '&nbsp;&nbsp;' . osc_icon('install.png') . '&nbsp;' . $osC_Language->get('icon_install') . '&nbsp;&nbsp;' . osc_icon('uninstall.png') . '&nbsp;' . $osC_Language->get('button_uninstall') . '&nbsp;&nbsp;' . osc_icon('info.png') . '&nbsp;' . $osC_Language->get('icon_info');
?>
</td>
  </tr>
</table>

<p><?php 
echo $osC_Language->get('modules_location') . ' ' . $osC_DirectoryListing->getDirectory();
?>
</p>
echo TABLE_HEADING_WRITEABLE;
?>
</th>
      <th><?php 
echo TABLE_HEADING_LAST_MODIFIED;
?>
</th>
    </tr>
  </thead>
  <tbody>
<?php 
$subdirectories = array();
for ($i = 0, $n = sizeof($files); $i < $n; $i++) {
    if ($files[$i]['name'] != '../' . $lng . '.php' && strpos($files[$i]['name'], '/') !== false) {
        $subdirectories[] = $files[$i]['name'];
    } else {
        echo '    <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);">' . "\n" . '      <td><a href="' . tep_href_link(FILENAME_DEFINE_LANGUAGE, 'lng=' . $lng . '&file=' . $files[$i]['name'] . '&action=edit') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/file.png', ICON_FILES, '16', '16') . '&nbsp;' . $files[$i]['name'] . '</a></td>' . "\n" . '      <td align="right">' . number_format(filesize($osC_DirectoryListing->getDirectory() . '/' . $files[$i]['name'])) . '</td>' . "\n" . '      <td align="center">' . tep_image('templates/' . $template . '/images/icons/' . (is_writable($osC_DirectoryListing->getDirectory() . '/' . $files[$i]['name']) ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif')) . '</td>' . "\n" . '      <td align="right">' . date('F d Y H:i:s', filemtime($osC_DirectoryListing->getDirectory() . '/' . $files[$i]['name'])) . '</td>' . "\n" . '    </tr>' . "\n";
    }
}
for ($i = 0, $n = sizeof($subdirectories); $i < $n; $i++) {
    echo '    <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);">' . "\n" . '      <td><a href="' . tep_href_link(FILENAME_DEFINE_LANGUAGE, 'lng=' . $lng . '&file=' . $subdirectories[$i] . '&action=edit') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/file.png', ICON_FILES, '16', '16') . '&nbsp;' . $subdirectories[$i] . '</a></td>' . "\n" . '      <td align="right">' . number_format(filesize($osC_DirectoryListing->getDirectory() . '/' . $subdirectories[$i])) . '</td>' . "\n" . '      <td align="center">' . tep_image('templates/' . $template . '/images/icons/' . (is_writable($osC_DirectoryListing->getDirectory() . '/' . $subdirectories[$i]) ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif')) . '</td>' . "\n" . '      <td align="right">' . date('F d Y H:i:s', filemtime($osC_DirectoryListing->getDirectory() . '/' . $subdirectories[$i])) . '</td>' . "\n" . '    </tr>' . "\n";
}
?>
  </tbody>
</table>

<p><?php 
echo TEXT_LANGUAGE_DIRECTORY . ' ' . $osC_DirectoryListing->getDirectory();
?>
</p>
Esempio n. 8
0
    ?>
</td>
        <td align="center"><tt><?php 
    echo tep_get_file_permissions($files[$i]['permissions']);
    ?>
</tt></td>
        <td><?php 
    echo $file_owner['name'];
    ?>
</td>
        <td><?php 
    echo $group_owner['name'];
    ?>
</td>
        <td align="center"><?php 
    echo tep_image('templates/' . $template . '/images/icons/' . (is_writable($osC_DirectoryListing->getDirectory() . '/' . $files[$i]['name']) ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif'));
    ?>
</td>
        <td align="right"><?php 
    echo date('F d Y H:i:s', $files[$i]['last_modified']);
    ?>
</td>
        <td align="right">
<?php 
    if ($files[$i]['is_directory'] === false) {
        echo '<a href="#" onClick="document.location.href=\'' . tep_href_link(FILENAME_FILE_MANAGER, 'entry=' . $files[$i]['name'] . '&action=fmEdit') . '\';">' . tep_image('templates/' . $template . '/images/icons/16x16/edit.png', IMAGE_EDIT, '16', '16') . '</a>' . '&nbsp;' . '<a href="#" onClick="document.location.href=\'' . tep_href_link(FILENAME_FILE_MANAGER, 'entry=' . $files[$i]['name'] . '&action=download') . '\';">' . tep_image('templates/' . $template . '/images/icons/16x16/save.png', IMAGE_SAVE, '16', '16') . '</a>' . '&nbsp;';
    } else {
        echo tep_image('images/pixel_trans.gif') . '&nbsp;' . tep_image('images/pixel_trans.gif') . '&nbsp;';
    }
    if (isset($fmInfo) && $files[$i]['name'] == $fmInfo->name) {
        echo '<a href="#" onClick="toggleInfoBox(\'fmDelete\');">' . tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . '</a>';