Esempio n. 1
0
/**
* Automatic uninstall function for plugins
*
* @return   array
*
* This code is automatically uninstalling the plugin.
* It passes an array to the core code function that removes
* tables, groups, features and php blocks from the tables.
* Additionally, this code can perform special actions that cannot be
* foreseen by the core code (interactions with other plugins for example)
*
*/
function plugin_autouninstall_nexfile()
{
    global $_TABLES, $_CONF;
    require_once $_CONF['path_system'] . 'nexpro/classes/tagcloud.class.php';
    $query = DB_query("SELECT itemid FROM {$_TABLES['tagworditems']} WHERE type = 'nexfile'");
    if (DB_numRows($query) > 0) {
        $tagcloud = new nexfileTagCloud();
        while ($A = DB_fetchArray($query)) {
            $tagcloud->clear_tags($A['itemid']);
        }
    }
    $out = array('tables' => array('nxfile_access', 'nxfile_categories', 'nxfile_files', 'nxfile_filedetail', 'nxfile_fileversions', 'nxfile_notifications', 'nxfile_filesubmissions', 'auditlog', 'nxfile_favorites', 'nxfile_recentfolders', 'nxfile_downloads', 'nxfile_usersettings', 'nxfile_notificationlog', 'nxfile_import_queue', 'nxfile_export_queue'), 'groups' => array('nexfile Admin'), 'features' => array('nexfile.admin', 'nexfile.edit', 'nexfile.user'), 'php_blocks' => array('phpblock_nexfile_latestfiles'), 'vars' => array('nexfile_admin'));
    return $out;
}
Esempio n. 2
0
                         $tpl->set_var('searchtag', stripslashes($tag));
                         $tpl->parse('searchtags', 'tagsearch_rec', true);
                     }
                 }
             } else {
                 $tpl->parse('searchtags', 'tagsearch_rec');
             }
             $data['retcode'] = 200;
             $data['currentsearchtags'] = $tpl->get_var('searchtags');
             nexdoc_displayTagSearchListing($tags, $data);
             $data['header'] = nexdoc_formatHeader($cid);
             $data['activefolder'] = nexdoc_displayActiveFolder(0, 'searchtags');
         } else {
             $data['retcode'] = 200;
             $data['currentsearchtags'] = '';
             $tagcloud = new nexfileTagCloud();
             $data['tagcloud'] = $tagcloud->displaycloud();
             $data['displayhtml'] = nexdocsrv_generateFileListing(0, 'latestfiles');
             $data['header'] = nexdoc_formatHeader($cid);
             $data['activefolder'] = nexdoc_displayActiveFolder(0, 'searchtags');
         }
     } else {
         $tagcloud = new nexfileTagCloud();
         $data['tagcloud'] = $tagcloud->displaycloud;
         $data['retcode'] = 203;
         // Partial Information
     }
     $retval = json_encode($data);
     break;
 case 'markfavorite':
     if ($uid > 1) {
Esempio n. 3
0
function nexdocsrv_approveFileSubmission($id)
{
    global $_TABLES, $_CONF, $_FMCONF;
    $query = DB_query("SELECT fid,cid,fname,tempname,title,description,tags,ftype,size,version,version_note,submitter,date,version_ctl,notify FROM {$_TABLES['nxfile_filesubmissions']} WHERE id={$id}");
    list($fid, $cid, $fname, $tmpname, $title, $description, $tags, $ftype, $fsize, $version, $verNote, $submitter, $date, $versionmgmt, $notify) = DB_fetchARRAY($query);
    $data = array();
    // Check if there have been multiple submission requests for the same file and thus have same new version #
    if ($version == 1) {
        if ($ftype == 'file') {
            $curfile = "{$_FMCONF['storage_path']}{$cid}/submissions/{$tmpname}";
            $newfile = "{$_FMCONF['storage_path']}{$cid}/{$fname}";
            $rename = @rename($curfile, $newfile);
        }
        DB_query("INSERT INTO {$_TABLES['nxfile_files']} (cid,fname,title,version,ftype,size,submitter,status,date,version_ctl)\r\n            VALUES ('{$cid}','{$fname}','{$title}','1','{$ftype}','{$fsize}','{$submitter}',1,'{$date}','{$versionmgmt}')");
        $newfid = DB_insertId();
        DB_query("INSERT INTO {$_TABLES['nxfile_filedetail']} (fid,description,hits,rating,votes,comments)\r\n            VALUES ('{$newfid}','{$description}',0,0,0,0)");
        DB_query("INSERT INTO {$_TABLES['nxfile_fileversions']} (fid,fname,ftype,version,notes,size,date,uid,status)\r\n            VALUES ('{$newfid}','{$uploadfilename}','{$ftype}','1','{$verNote}','{$fsize}','{$date}','{$submitter}',1)");
    } else {
        // Need to rename the current versioned file
        if ($ftype == 'file') {
            $curfile = $_CONF['path_html'] . 'nexfile/data/' . $cid . '/submissions/' . $tmpname;
            $newfile = $_CONF['path_html'] . 'nexfile/data/' . $cid . '/' . $fname;
            $rename = @rename($curfile, $newfile);
        }
        DB_query("INSERT INTO {$_TABLES['nxfile_fileversions']} (fid,fname,ftype,version,notes,size,date,uid,status)\r\n           VALUES ('{$fid}','{$fname}','{$ftype}','{$version}','{$verNote}','{$fsize}','{$date}','{$submitter}','1')");
        DB_query("UPDATE {$_TABLES['nxfile_files']} SET fname='{$fname}',version='{$version}', date='{$date}' WHERE fid={$fid}");
        $newfid = $fid;
    }
    if ($newfid > 0) {
        $tagcloud = new nexfileTagCloud();
        // Update tags table and return tags formated as required
        $tagcloud->update_tags($newfid, $tags);
        // Send out notifications of approval
        fm_sendNotification($newfid, "2");
        DB_query("DELETE FROM {$_TABLES['nxfile_filesubmissions']} WHERE id={$id}");
        // Optionally add notification records and send out notifications to all users with view access to this new file
        if (DB_getItem($_TABLES['nxfile_categories'], 'auto_create_notifications', "cid='{$cid}'") == 1) {
            fm_autoCreateNotifications($fid, $cid);
        }
        // Send out notifications of update to all subscribed users
        fm_sendNotification($newfid, "1");
        return true;
    } else {
        return false;
    }
}
Esempio n. 4
0
$tpl->set_var('newfolder_options', nexdoc_recursiveAccessOptions('admin'));
$tpl->set_var('movefolder_options', nexdoc_recursiveAccessOptions(array('upload_dir')));
$tpl->set_var('newfile_category_options', nexdoc_recursiveAccessOptions(array('upload', 'upload_dir')));
$adminFolders = nexdoc_recursiveAccessOptions('admin');
if ($adminFolders != '') {
    $tpl->set_var('newfolder_options', $adminFolders);
    $tpl->parse('newfolder_dialog', 'newfolderdiv');
    $tpl->parse('newfolder_menuitem', 'newfolderlink');
}
$uploadFolders = nexdoc_recursiveAccessOptions(array('upload', 'upload_dir'));
if ($uploadFolders != '') {
    $tpl->set_var('newfile_category_options', $uploadFolders);
    $tpl->parse('newfile_dialog', 'newfilediv');
    $tpl->parse('newfile_menuitem', 'newfilelink');
}
if (SEC_hasRights('nexfile.edit')) {
    $tpl->parse('folderadmin_link', 'folderadminlink');
}
$tagcloud = new nexfileTagCloud();
$tpl->set_var('tag_cloud', $tagcloud->displaycloud());
$tpl->parse('toolbar', 'toolbar');
$tpl->parse('filelisting_header', 'header');
$tpl->parse('file_details_panel', 'filedetails');
$tpl->parse('newfolder_dialog', 'newfolderdiv');
$tpl->parse('newfile_dialog', 'newfilediv');
$tpl->parse('movefiles_dialog', 'movefilesdiv');
$tpl->parse('moveQueuefile_dialog', 'movequeuefile');
$tpl->parse('broadcast_dialog', 'broadcast');
$tpl->parse('output', 'page');
echo $tpl->finish($tpl->get_var('output'));
echo COM_siteFooter();