Esempio n. 1
0
* You should have received a copy of the GNU Affero General Public License     *
* along with this program.  If not, see <http://www.gnu.org/licenses/>.        *
*                                                                              *
*******************************************************************************/
function findInSearchPaths($app)
{
    $ar = array('../resources/webclient/apps/');
    foreach ($ar as $apath) {
        if (file_exists($apath . $app) && is_dir($apath . $app)) {
            return $apath . $app;
        }
    }
    return false;
}
// Get the groups for authentication
$r = AuthenticateApplication($args->args->application, $User->ID);
if ($r && substr($r, 0, 4) == 'fail') {
    die($r);
}
if ($row = $SqlDatabase->FetchObject('
	SELECT * FROM FApplication WHERE UserID=\'' . $User->ID . '\' AND `Name` = "' . $args->args->application . '"
')) {
    if ($ur = $SqlDatabase->FetchObject('
		SELECT * FROM FUserApplication WHERE UserID=\'' . $User->ID . '\' AND ApplicationID=\'' . $row->ID . '\'
	')) {
        $conf = json_decode($row->Config);
        $conf->Permissions = json_decode($ur->Permissions);
        $conf->AuthID = $ur->AuthID;
        if ($path = findInSearchPaths($args->args->application)) {
            $conf->Path = str_replace('../resources', '', $path) . '/';
        } else {
Esempio n. 2
0
         $o = new stdClass();
         $o->Filename = $cate[count($cate) - 1];
         $o->Type = 'Directory';
         $o->MetaType = 'Directory';
         $o->IconFile = 'gfx/icons/128x128/places/folder-brown.png';
         $o->Path = 'System:Software/' . implode('/', $cate) . '/';
         $o->Permissions = '';
         $o->DateModified = date('Y-m-d H:i:s');
         $o->DateCreated = '1970-01-01 00:00:00';
         $out[] = $o;
     }
 }
 if (count($apps)) {
     foreach ($apps as $app) {
         // Only allowed apps
         $r = AuthenticateApplication($app->Filename, $User->ID, $searchGroups);
         if ($r && substr($r, 0, 4) == 'fail') {
             continue;
         }
         $o = new stdClass();
         $o->Filename = $app->Filename;
         $o->Type = 'Executable';
         $o->MetaType = 'File';
         if (file_exists('resources/webclient/apps/' . $app->Filename . '/icon.png')) {
             $o->IconFile = '/webclient/apps/' . $app->Filename . '/icon.png';
         }
         $o->Path = 'System:Software/' . $app->Cat . '/';
         $o->Permissions = '';
         $o->DateModified = date('Y-m-d H:i:s');
         $o->DateCreated = '1970-01-01 00:00:00';
         $out[] = $o;