Beispiel #1
0
function pathos_core_incrementLocationReference($loc, $section)
{
    global $db;
    $newLocRef = $db->selectObject("locationref", "module='" . $loc->mod . "' AND source='" . $loc->src . "' AND internal='" . $loc->int . "'");
    $is_new = false;
    // For the is_original sectionref attribute
    if ($newLocRef != null) {
        // Pulled an existing source.  Update refcount
        $newLocRef->refcount += 1;
        $db->updateObject($newLocRef, "locationref", "module='" . $loc->mod . "' AND source='" . $loc->src . "' AND internal='" . $loc->int . "'");
    } else {
        $is_new = true;
        // New source.  Populate reference
        $newLocRef->module = $loc->mod;
        $newLocRef->source = $loc->src;
        $newLocRef->internal = $loc->int;
        $newLocRef->refcount = 1;
        $db->insertObject($newLocRef, "locationref");
        // Go ahead and assign permissions on contained module.
        $perms = call_user_func(array($loc->mod, "permissions"));
        global $user;
        foreach (array_keys($perms) as $perm) {
            pathos_permissions_grant($user, $perm, $loc);
        }
        pathos_permissions_triggerSingleRefresh($user);
    }
    $newSecRef = $db->selectObject("sectionref", "module='" . $loc->mod . "' AND source='" . $loc->src . "' AND internal='" . $loc->int . "' AND section={$section}");
    if ($newSecRef != null) {
        // Pulled an existing source for this section.  Update refcount
        $newSecRef->refcount += 1;
        $db->updateObject($newSecRef, "sectionref", "module='" . $loc->mod . "' AND source='" . $loc->src . "' AND internal='" . $loc->int . "' AND section={$section}");
    } else {
        // New source for this section.  Populate reference
        $newSecRef->module = $loc->mod;
        $newSecRef->source = $loc->src;
        $newSecRef->internal = $loc->int;
        $newSecRef->section = $section;
        $newSecRef->refcount = 1;
        $newSecRef->is_original = $is_new ? 1 : 0;
        $db->insertObject($newSecRef, "sectionref");
    }
}
        $directory = 'files/imagegallerymodule/' . $loc->src . '/gallery' . $id;
        #.'/.thumbs';
        if (!file_exists(BASE . $directory)) {
            $err = pathos_files_makeDirectory($directory);
            if ($err != SYS_FILES_SUCCESS) {
                echo '<div class="error">';
                if ($err == SYS_FILES_FOUNDFILE) {
                    echo TR_FILEMANAGER_FILEFOUNDINPATH;
                } else {
                    if ($err == SYS_FILES_NOTWRITABLE) {
                        echo TR_FILEMANAGER_CANTMKDIR;
                    } else {
                        echo TR_FILEMANAGER_UNKNOWNERROR;
                    }
                }
                echo '</div>';
                $db->delete('imagegallery_gallery', 'id=' . $id);
                return;
            }
        }
        // Assign permissions -- need to create an internal loc
        $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $id);
        foreach (array_keys(imagegallerymodule::permissions($id)) as $perm) {
            pathos_permissions_grant($user, $perm, $iloc);
        }
        pathos_permissions_triggerSingleRefresh($user);
    }
    pathos_flow_redirect();
} else {
    echo SITE_403_HTML;
}
Beispiel #3
0
            $post->posted = time();
        } else {
            $post->editor = $user->id;
            $post->edited = time();
        }
        $db->updateObject($post, 'weblog_post');
    } else {
        if ($db->countObjects('weblog_post', "internal_name='" . $post->internal_name . "'")) {
            $_POST['_formError'] = 'That Internal Name is already in use.  Please choose another.';
            unset($_POST['internal_name']);
            pathos_sessions_set('last_POST', $_POST);
            header('Location: ' . $_SERVER['HTTP_REFERER']);
            exit('');
        }
        $post->poster = $user->id;
        $post->posted = time();
        $post->id = $db->insertObject($post, 'weblog_post');
        $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $post->id);
        // New, so asign full perms.
        pathos_permissions_grant($user, 'edit', $iloc);
        pathos_permissions_grant($user, 'delete', $iloc);
        pathos_permissions_grant($user, 'comment', $iloc);
        pathos_permissions_grant($user, 'edit_comments', $iloc);
        pathos_permissions_grant($user, 'delete_comments', $iloc);
        pathos_permissions_grant($user, 'view_private', $iloc);
        pathos_permissions_triggerSingleRefresh($user);
    }
    pathos_flow_redirect();
} else {
    echo SITE_403_HTML;
}
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: saveuserperms.php,v 1.5 2005/04/18 15:22:39 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
if (pathos_permissions_check("administrate", $loc)) {
    $users = explode(";", $_POST['permdata']);
    if (!defined("SYS_USERS")) {
        require_once BASE . "subsystems/users.php";
    }
    foreach ($users as $user_str) {
        $perms = explode(":", $user_str);
        $u = pathos_users_getUserById($perms[0]);
        pathos_permissions_revokeAll($u, $loc);
        for ($i = 1; $i < count($perms); $i++) {
            pathos_permissions_grant($u, $perms[$i], $loc);
        }
        if ($perms[0] == $user->id) {
            pathos_permissions_load($user);
        }
    }
    pathos_permissions_triggerRefresh();
    pathos_flow_redirect();
} else {
    echo SITE_403_HTML;
}
Beispiel #5
0
 if (!isset($resource->id)) {
     $resource->rank = $_POST['rank'];
     $db->increment('resourceitem', 'rank', 1, "location_data='" . serialize($loc) . "' AND rank >= " . $resource->rank);
 }
 if (!isset($resource->file_id)) {
     $directory = "files/resourcesmodule/" . $loc->src;
     if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {
         $file = file::update("file", $directory, null, time() . "_" . $_FILES['file']['name']);
         if ($file != null) {
             $resource->file_id = $db->insertObject($file, "file");
             $id = $db->insertObject($resource, "resourceitem");
             // Assign new perms on loc
             $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $id);
             pathos_permissions_grant($user, "edit", $iloc);
             pathos_permissions_grant($user, "delete", $iloc);
             pathos_permissions_grant($user, "administrate", $iloc);
             pathos_permissions_triggerSingleRefresh($user);
             if (!defined("SYS_WORKFLOW")) {
                 require_once BASE . "subsystems/workflow.php";
             }
             $resource->id = $id;
             $resource->poster = $user->id;
             $resource->posted = time();
             pathos_workflow_post($resource, "resourceitem", $loc);
         }
     } else {
         pathos_lang_loadDictionary('modules', 'filemanager');
         switch ($_FILES["file"]["error"]) {
             case UPLOAD_ERR_INI_SIZE:
             case UPLOAD_ERR_FORM_SIZE:
                 echo TR_FILEMANAGER_FILETOOLARGE;