Example #1
0
 public function instanceUsesProjectID(Project $project)
 {
     return is_dir(forge_get_config('projects_path', 'mediawiki') . "/" . $project->getID());
 }
Example #2
0
         $preferences['emailaddress']['default'] = $user->getEmail();
         unset($preferences['emailauthentication']);
         unset($preferences['password']);
         return true;
     }
 }
 $wgGroupPermissions = customizeMediawikiGroupsRights($wgGroupPermissions, $manager, $fusionforgeproject, $forbidden_permissions, $read_permissions, $write_permissions);
 $wgFavicon = '/images/icon.png';
 $wgBreakFrames = false;
 if (forge_get_config('unbreak_frames', 'mediawiki')) {
     $wgEditPageFrameOptions = false;
 }
 ini_set('memory_limit', '100M');
 // LOAD THE SITE-WIDE AND PROJECT-SPECIFIC EXTRA-SETTINGS
 if (is_file(forge_get_config('config_path') . "/plugins/mediawiki/LocalSettings.php")) {
     include forge_get_config('config_path') . "/plugins/mediawiki/LocalSettings.php";
 }
 // debian style system-wide mediawiki extensions
 if (is_file("/etc/mediawiki-extensions/extensions.php")) {
     include '/etc/mediawiki-extensions/extensions.php';
 }
 if (file_exists("{$wgUploadDirectory}/.wgLogo.png")) {
     $wgLogo = "{$wgScriptPath}/images/.wgLogo.png";
 }
 // forge global settings
 if (is_file("{$gconfig_dir}/ForgeSettings.php")) {
     include "{$gconfig_dir}/ForgeSettings.php";
 }
 // project specific settings
 if (is_file("{$project_dir}/ProjectSettings.php")) {
     include "{$project_dir}/ProjectSettings.php";
Example #3
0
 private function addForgeBackLinksToSidebar()
 {
     $forge_name = forge_get_config('sys_fullname');
     $added_toolbox = array(array('text' => $GLOBALS['Language']->getText('plugin_mediawiki', 'back_to_forge', array($forge_name)), 'href' => '/projects/' . $GLOBALS['group']->getUnixName()));
     if ($this->IsUserAdmin()) {
         $added_toolbox[] = array('text' => $GLOBALS['Language']->getText('global', 'Administration'), 'href' => '/plugins/mediawiki/forge_admin?group_id=' . $GLOBALS['group']->getId());
     }
     $this->data['sidebar'][$forge_name] = $added_toolbox;
 }
 /**
  * Outputs project's DOAP profile
  * @param unknown_type $params
  */
 function content_negociated_project_home(&$params)
 {
     $projectname = $params['groupname'];
     $accept = $params['accept'];
     $group_id = $params['group_id'];
     if ($accept == 'application/rdf+xml') {
         // connect to FusionForge internals
         $pm = ProjectManager::instance();
         $project = $pm->getProject($group_id);
         $project_shortdesc = $project->getPublicName();
         $project_description = $project->getDescription();
         $tags_list = NULL;
         if (forge_get_config('use_project_tags')) {
             $group = group_get_object($group_id);
             $tags_list = $group->getTags();
         }
         // We will return RDF+XML
         $params['content_type'] = 'application/rdf+xml';
         // Construct an ARC2_Resource containing the project's RDF (DOAP) description
         $ns = array('rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'doap' => 'http://usefulinc.com/ns/doap#', 'dcterms' => 'http://purl.org/dc/terms/', 'schema' => 'http://schema.org/');
         $conf = array('ns' => $ns);
         $res = ARC2::getResource($conf);
         $res->setURI(util_make_url_g($projectname, $group_id));
         // $res->setRel('rdf:type', 'doap:Project');
         rdfutils_setPropToUri($res, 'rdf:type', 'doap:Project');
         $res->setProp('doap:name', $projectname);
         $res->setProp('doap:shortdesc', $project_shortdesc);
         if ($project_description) {
             $res->setProp('doap:description', $project_description);
         }
         $res->setProp('doap:homepage', $project->getHomePage());
         $tags = array();
         if ($tags_list) {
             $tags = split(', ', $tags_list);
             $res->setProp('dcterms:subject', $tags);
         }
         // Now, we need to collect complementary RDF descriptiosn of the project via other plugins
         // invoke the 'project_rdf_metadata' hook so as to complement the RDF description
         $hook_params = array();
         $hook_params['prefixes'] = array();
         foreach ($ns as $prefix => $url) {
             $hook_params['prefixes'][$url] = $prefix;
         }
         $hook_params['group'] = $group_id;
         // pass the resource in case it could be useful (read-only in principle)
         $hook_params['in_Resource'] = $res;
         $hook_params['out_Resources'] = array();
         plugin_hook_by_reference('project_rdf_metadata', $hook_params);
         // add new prefixes to the list
         foreach ($hook_params['prefixes'] as $url => $prefix) {
             if (!isset($ns[$prefix])) {
                 $ns[$prefix] = $url;
             }
         }
         // merge the two sets of triples
         $merged_index = $res->index;
         foreach ($hook_params['out_Resources'] as $out_res) {
             $merged_index = ARC2::getMergedIndex($merged_index, $out_res->index);
         }
         $conf = array('ns' => $ns, 'serializer_type_nodes' => true);
         $ser = ARC2::getRDFXMLSerializer($conf);
         /* Serialize a resource index */
         $doc = $ser->getSerializedIndex($merged_index);
         $params['content'] = $doc . "\n";
     }
 }
Example #5
0
    require_once "{$IP}/extensions/WikiEditor/WikiEditor.php";
    # Enables use of WikiEditor by default but still allow users to disable it in preferences
    $wgDefaultUserOptions['usebetatoolbar'] = 1;
    $wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;
    # Displays the Preview and Changes tabs
    $wgDefaultUserOptions['wikieditor-preview'] = 1;
    # Displays the Publish and Cancel buttons on the top right side
    $wgDefaultUserOptions['wikieditor-publish'] = 1;
}
// TuleapArtLinks Extension inclusion
require_once dirname(__FILE__) . '/../extensions/TuleapArtLinks/TuleapArtLinks.php';
$wgTuleapArtLinksGroupId = $group->getGroupId();
$mleb_manager_loader = new MediawikiMLEBExtensionManagerLoader();
$mleb_manager = $mleb_manager_loader->getMediawikiMLEBExtensionManager();
if ($mleb_manager->isMLEBExtensionAvailableForProject($group) || isset($IS_RUNNING_UPDATE) && $IS_RUNNING_UPDATE) {
    $mleb_path = forge_get_config('extension_mleb_path', 'mediawiki');
    # Babelww
    require_once $mleb_path . "/extensions/Babel/Babel.php";
    # CLDR
    require_once $mleb_path . "/extensions/cldr/cldr.php";
    # CleanChanges
    require_once $mleb_path . "/extensions/CleanChanges/CleanChanges.php";
    $wgCCTrailerFilter = true;
    $wgCCUserFilter = false;
    $wgDefaultUserOptions['usenewrc'] = 1;
    # LocalisationUpdate
    require_once $mleb_path . "/extensions/LocalisationUpdate/LocalisationUpdate.php";
    $wgLocalisationUpdateDirectory = $mleb_path . "/cache";
    # Translate
    require_once $mleb_path . "/extensions/Translate/Translate.php";
    $wgGroupPermissions['user']['translate'] = true;
 private function updateMediawikiDirectory(Project $project)
 {
     $logger = new BackendLogger();
     $project_id_dir = forge_get_config('projects_path', 'mediawiki') . "/" . $project->getID();
     if (is_dir($project_id_dir)) {
         return true;
     }
     $project_name_dir = forge_get_config('projects_path', 'mediawiki') . "/" . $project->getUnixName();
     if (is_dir($project_name_dir)) {
         exec("mv {$project_name_dir} {$project_id_dir}");
         return true;
     }
     $logger->error('Project Rename: Can\'t find mediawiki directory for project: ' . $project->getID());
     return false;
 }
 public function isMLEBExtensionInstalled()
 {
     return is_dir(forge_get_config('extension_mleb_path', 'mediawiki'));
 }
Example #8
0
            cron_debug($err);
            cron_entry(23, $err);
            db_rollback();
            exit;
        }
        if (!db_commit()) {
            $err = "Error: DB Commit Failed: " . db_error();
            cron_debug($err);
            cron_entry(23, $err);
            exit;
        }
        cron_debug("  Creating project dir {$project_dir}.");
        mkdir($project_dir, 0775, true);
        $f = fopen("{$project_dir}/ProjectSettings.php", "w");
        fwrite($f, '<?php
// Insert your project-local configuration here
');
        fclose($f);
        chmod("{$project_dir}/ProjectSettings.php", 0775);
        $mwwrapper = forge_get_config('source_path') . "/plugins/mediawiki/bin/mw-wrapper.php";
        $dumpfile = forge_get_config('config_path') . "/mediawiki/initial-content.xml";
        if (file_exists($dumpfile)) {
            system("{$mwwrapper} {$project} importDump.php {$dumpfile}");
            system("{$mwwrapper} {$project} rebuildrecentchanges.php");
        }
    }
}
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
 /**
  * @return boolean
  */
 private function doesDirectoryExist()
 {
     $name_with_id = forge_get_config('projects_path', 'mediawiki') . '/' . $this->project_id;
     $name_with_shortname = forge_get_config('projects_path', 'mediawiki') . '/' . $this->project_name;
     if (is_dir($name_with_id)) {
         $this->project_name_dir = $name_with_id;
         $dir_exists = true;
     } elseif (is_dir($name_with_shortname)) {
         $this->project_name_dir = $name_with_shortname;
         $dir_exists = true;
     } else {
         $this->project_name_dir = $name_with_id;
         $dir_exists = false;
     }
     return $dir_exists;
 }
Example #10
0
            mysymlink($from, $to);
        }
    }
    closedir($dh);
}
// link LocalSettings.php from forge_get_config('source_path')/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
$from = forge_get_config('source_path') . "/plugins/mediawiki/www/LocalSettings.php";
$to = "{$master_path}/LocalSettings.php";
mysymlink($from, $to);
// create skin directory
$todir = "{$master_path}/skins";
if (!is_dir($todir)) {
    mkdir($todir);
}
// link FusionForge skin file
$fromdir = forge_get_config('source_path') . "/plugins/mediawiki/mediawiki-skin";
$from = "{$fromdir}/FusionForge.php";
$to = "{$todir}/FusionForge.php";
mysymlink($from, $to);
// create skin subdir
$todir = "{$todir}/fusionforge";
if (!is_dir($todir)) {
    mkdir($todir);
}
// link fusionforge.css files
$fromdir = "{$fromdir}/fusionforge";
$from = "{$fromdir}/fusionforge.css";
$to = "{$todir}/fusionforge.css";
mysymlink($from, $to);
// link the rest of the files from monobook skin
$fromdir = "{$src_path}/skins/monobook";
Example #11
0
 /**
  * Outputs the public projects list as ADMS.SW for /projects
  * @param unknown_type $params
  */
 function content_negociated_projects_list(&$params)
 {
     $accept = $params['accept'];
     if ($accept == 'application/rdf+xml') {
         // We will return RDF+XML
         $params['content_type'] = 'application/rdf+xml';
         // Construct an ARC2_Resource containing the project's RDF (DOAP) description
         $ns = array('rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'doap' => 'http://usefulinc.com/ns/doap#', 'dcterms' => 'http://purl.org/dc/terms/', 'admssw' => 'http://purl.org/adms/sw/', 'adms' => 'http://www.w3.org/ns/adms#');
         $conf = array('ns' => $ns);
         $res = ARC2::getResource($conf);
         $res->setURI(util_make_url("/projects"));
         // $res->setRel('rdf:type', 'doap:Project');
         rdfutils_setPropToUri($res, 'rdf:type', 'admssw:SoftwareRepository');
         //$res->setProp('doap:name', $projectname);
         $res->setProp('adms:accessURL', util_make_url("/softwaremap/"));
         $forge_name = forge_get_config('forge_name');
         $ff = new FusionForge();
         $res->setProp('dcterms:description', 'Public projects in the ' . $ff->software_name . ' Software Map on ' . $forge_name);
         $res->setProp('rdfs:label', $forge_name . ' public projects');
         $res->setProp('adms:supportedSchema', 'ADMS.SW v1.0');
         // same as for trove's full list
         $projects = get_public_active_projects_asc();
         $proj_uris = array();
         foreach ($projects as $row_grp) {
             $proj_uri = util_make_url_g(strtolower($row_grp['unix_group_name']), $row_grp['group_id']);
             $proj_uris[] = $proj_uri;
         }
         if (count($proj_uris)) {
             rdfutils_setPropToUri($res, 'dcterms:hasPart', $proj_uris);
         }
         $conf = array('ns' => $ns, 'serializer_type_nodes' => true);
         $ser = ARC2::getRDFXMLSerializer($conf);
         /* Serialize a resource index */
         $doc = $ser->getSerializedIndex($res->index);
         $params['content'] = $doc . "\n";
     }
 }
Example #12
0
    // indicate byte-level equality of content.  (Due to DEBUG timing output, etc...)
    //
    // (If DEBUG if off, this may be a strong validator, but I'm going
    // to go the paranoid route here pending further study and testing.)
    // access hits and edit stats in the footer violate strong ETags also.
    if (1 or DEBUG) {
        $validators['%weak'] = true;
    }
    $request->setValidators($validators);
    $request->handleAction();
    if (DEBUG and DEBUG & _DEBUG_INFO) {
        phpinfo(INFO_VARIABLES | INFO_MODULES);
    }
    $request->finish();
}
if (!FUSIONFORGE || forge_get_config('installation_environment') != 'production') {
    if (defined('E_STRICT') and E_ALL & E_STRICT) {
        // strict php5?
        error_reporting(E_ALL & ~E_STRICT);
    } else {
        error_reporting(E_ALL);
    }
    // php4
} else {
    error_reporting(E_ERROR);
}
// don't run the main loop for special requests (test, getimg, xmlrpc, soap, ...)
if (!defined('PHPWIKI_NOMAIN') or !PHPWIKI_NOMAIN) {
    main();
}
// Local Variables:
Example #13
0
/**
 * Construct the base URL http[s]://forge_name[:port]
 *
 * @param       string  $prefix (optional) : 'http' or 'https' to force it
 * @return	string base URL
 */
function util_make_base_url($prefix = '')
{
    $url = util_url_prefix($prefix);
    $url .= forge_get_config('web_host');
    if (forge_get_config('https_port') && forge_get_config('https_port') != 443) {
        $url .= ":" . forge_get_config('https_port');
    }
    return $url;
}
Example #14
0
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/** This script will automatically create the image upload
   directories for all mediawiki instances.

   It is intended to be started in a cronjob with root permissions.
   */
require_once dirname(__FILE__) . '/../../../www/env.inc.php';
require_once $gfcommon . 'include/pre.php';
require_once $gfcommon . 'include/cron_utils.php';
if (forge_get_config('enable_uploads', 'mediawiki')) {
    $upload_dir_basename = "images";
    $projects_path = forge_get_config('projects_path', 'mediawiki');
    # Owner of files - apache
    $dir_owner = forge_get_config('apache_user');
    $dir_group = forge_get_config('apache_group');
    # Get all projects that use the mediawiki plugin
    $project_res = db_query_params("SELECT g.unix_group_name from groups g, group_plugin gp, plugins p where g.group_id = gp.group_id and gp.plugin_id = p.plugin_id and p.plugin_name = \$1;", array("mediawiki"));
    if (!$project_res) {
        $err = "Error: Database Query Failed: " . db_error();
        cron_debug($err);
        cron_entry(23, $err);
        exit;
    }
    # Loop over all projects that use the plugin
    while ($row = db_fetch_array($project_res)) {
        $project = $row['unix_group_name'];
        $project_dir = "{$projects_path}/{$project}";
        cron_debug("Checking {$project}...");
        // Create the image directory if necessary
        $upload_dir = "{$project_dir}/{$upload_dir_basename}";
Example #15
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/** This script will destroy a mediawiki instance of a specific project.     */
if ($argc < 2) {
    echo "Usage " . $argv[0] . " <project>\n";
    exit(0);
}
require_once dirname(__FILE__) . '/../../../www/env.inc.php';
require_once $gfcommon . 'include/pre.php';
$projects_path = forge_get_config('projects_path', 'mediawiki');
array_shift($argv);
foreach ($argv as $project) {
    echo "Removing project wiki of {$project}.\n";
    $project_dir = "{$projects_path}/{$project}";
    echo "  Deleting project subdir {$project_dir}.\n";
    if (!is_dir($project_dir)) {
        echo "{$project_dir} does not exist!\n";
    } else {
        system("rm -rf {$project_dir}");
    }
    $schema = "plugin_mediawiki_{$project}";
    strtr($schema, "-", "_");
    echo "  Dropping database schema {$schema}.\n";
    $res = db_query_params("DROP SCHEMA {$schema} CASCADE", array());
    if (!$res) {
Example #16
0
 /**
  * fetchData - May need to refresh database fields.
  *
  * If an update occurred and you need to access the updated info.
  *
  * @return	boolean	success;
  */
 function fetchData($role_id)
 {
     unset($this->data_array);
     unset($this->setting_array);
     unset($this->perms_array);
     if (USE_PFO_RBAC) {
         $res = db_query_params('SELECT * FROM pfo_role WHERE role_id=$1', array($role_id));
         if (!$res || db_numrows($res) < 1) {
             $this->setError('BaseRole::fetchData()::' . db_error());
             return false;
         }
         $this->data_array = db_fetch_array($res);
         if ($this->data_array['is_public'] == 't') {
             $this->data_array['is_public'] = true;
         } else {
             $this->data_array['is_public'] = false;
         }
         $res = db_query_params('SELECT section_name, ref_id, perm_val FROM pfo_role_setting WHERE role_id=$1', array($role_id));
         if (!$res) {
             $this->setError('BaseRole::fetchData()::' . db_error());
             return false;
         }
         // TODO: document perms_array
         $this->perms_array = array();
         while ($arr = db_fetch_array($res)) {
             $this->perms_array[$arr['section_name']][$arr['ref_id']] = $arr['perm_val'];
         }
     } else {
         if ($this instanceof RoleAnonymous) {
             $res = db_query_params('SELECT group_id, enable_anonscm FROM groups WHERE is_public=1', array());
             while ($arr = db_fetch_array($res)) {
                 $this->perms_array['project_read'][$arr['group_id']] = 1;
                 $this->perms_array['frs'][$arr['group_id']] = 1;
                 $this->perms_array['scm'][$arr['group_id']] = $arr['enable_anonscm'];
             }
             $res = db_query_params('SELECT t.group_artifact_id FROM artifact_group_list t, groups g WHERE t.is_public=1 AND t.allow_anon=1 AND g.is_public=1 AND t.group_id = g.group_id', array());
             while ($arr = db_fetch_array($res)) {
                 $this->perms_array['tracker'][$arr['group_artifact_id']] = 1;
             }
             $res = db_query_params('SELECT p.group_project_id FROM project_group_list p, groups g WHERE p.is_public=1 AND g.is_public=1 AND p.group_id = g.group_id', array());
             while ($arr = db_fetch_array($res)) {
                 $this->perms_array['pm'][$arr['group_project_id']] = 1;
             }
             $res = db_query_params('SELECT f.group_forum_id, f.allow_anonymous, f.moderation_level FROM forum_group_list f, groups g WHERE f.is_public=1 AND g.is_public=1 AND f.group_id = g.group_id', array());
             while ($arr = db_fetch_array($res)) {
                 if ($arr['allow_anonymous'] == 1) {
                     if ($arr['moderation_level'] == 0) {
                         $this->perms_array['forum'][$arr['group_forum_id']] = 3;
                     } else {
                         $this->perms_array['forum'][$arr['group_forum_id']] = 2;
                     }
                 } else {
                     $this->perms_array['forum'][$arr['group_forum_id']] = 1;
                 }
             }
         } elseif ($this instanceof RoleLoggedIn) {
             $res = db_query_params('SELECT group_id, enable_anonscm FROM groups WHERE is_public=1', array());
             while ($arr = db_fetch_array($res)) {
                 $this->perms_array['project_read'][$arr['group_id']] = 1;
                 $this->perms_array['frs'][$arr['group_id']] = 1;
                 $this->perms_array['scm'][$arr['group_id']] = $arr['enable_anonscm'];
             }
             $res = db_query_params('SELECT t.group_artifact_id FROM artifact_group_list t, groups g WHERE t.is_public=1 AND g.is_public=1 AND t.group_id = g.group_id', array());
             while ($arr = db_fetch_array($res)) {
                 $this->perms_array['tracker'][$arr['group_artifact_id']] = 1;
             }
             $res = db_query_params('SELECT p.group_project_id FROM project_group_list p, groups g WHERE p.is_public=1 AND g.is_public=1 AND p.group_id = g.group_id', array());
             while ($arr = db_fetch_array($res)) {
                 $this->perms_array['pm'][$arr['group_project_id']] = 1;
             }
             $res = db_query_params('SELECT f.group_forum_id, f.moderation_level FROM forum_group_list f, groups g WHERE f.is_public=1 AND g.is_public=1 AND f.group_id = g.group_id', array());
             while ($arr = db_fetch_array($res)) {
                 if ($arr['moderation_level'] == 0) {
                     $this->perms_array['forum'][$arr['group_forum_id']] = 3;
                 } else {
                     $this->perms_array['forum'][$arr['group_forum_id']] = 2;
                 }
             }
         } else {
             $res = db_query_params('SELECT * FROM role WHERE role_id=$1', array($role_id));
             if (!$res || db_numrows($res) < 1) {
                 $this->setError('BaseRole::fetchData()::' . db_error());
                 return false;
             }
             $this->data_array = db_fetch_array($res);
             // Load pre-PFO RBAC settings...
             $res = db_query_params('SELECT * FROM role_setting WHERE role_id=$1', array($role_id));
             if (!$res) {
                 $this->setError('BaseRole::fetchData()::' . db_error());
                 return false;
             }
             $this->setting_array = array();
             while ($arr = db_fetch_array($res)) {
                 $this->setting_array[$arr['section_name']][$arr['ref_id']] = $arr['value'];
             }
             // ...and map section names and values to the new values
             if ($this->data_array['group_id'] == forge_get_config('stats_group')) {
                 $this->perms_array['forge_stats'][-1] = 2;
             }
             $this->perms_array = array();
             $tohandle = array();
             $gid = $this->data_array['group_id'];
             if ($gid == 1 && count($this->setting_array) == 0) {
                 $tohandle[] = array('forge_admin', -1);
             }
             foreach ($this->setting_array as $oldsection => $t) {
                 switch ($oldsection) {
                     case 'projectadmin':
                         $tohandle[] = array('project_admin', $gid);
                         if ($this->data_array['group_id'] == 1 && $t[0] == 'A') {
                             $tohandle[] = array('forge_admin', -1);
                         }
                         if ($this->data_array['group_id'] == forge_get_config('news_group') && $t[0] == 'A') {
                             $tohandle[] = array('approve_news', -1);
                         }
                         if ($this->data_array['group_id'] == forge_get_config('stats_group') && $t[0] == 'A') {
                             $tohandle[] = array('forge_stats', -1);
                         }
                         break;
                     case 'trackeradmin':
                         $tohandle[] = array('tracker_admin', $gid);
                         break;
                     case 'pmadmin':
                         $tohandle[] = array('pm_admin', $gid);
                         break;
                     case 'forumadmin':
                         $tohandle[] = array('forum_admin', $gid);
                         break;
                     case 'newtracker':
                         $tohandle[] = array('new_tracker', $gid);
                         break;
                     case 'newpm':
                         $tohandle[] = array('new_pm', $gid);
                         break;
                     case 'newforum':
                         $tohandle[] = array('new_forum', $gid);
                         break;
                     default:
                         foreach ($t as $oldreference => $oldvalue) {
                             $tohandle[] = array($oldsection, $oldreference);
                             break;
                         }
                 }
             }
             foreach ($tohandle as $t) {
                 $nsec = $t[0];
                 $nref = $t[1];
                 $res = db_query_params('SELECT pfo_rbac_permissions_from_old($1,$2,$3)', array($role_id, $nsec, $nref));
                 if ($res) {
                     $arr = db_fetch_array($res);
                     $this->perms_array[$nsec][$nref] = $arr[0];
                 }
             }
         }
         // Explicit role (not Anonymous or LoggedIn)
     }
     return true;
 }
Example #17
0
$project_res = db_query_params("SELECT g.unix_group_name,g.group_id from groups g, group_plugin gp, plugins p where g.group_id = gp.group_id and gp.plugin_id = p.plugin_id and p.plugin_name = \$1;", array("mediawiki"));
if (!$project_res) {
    $err = "Error: Database Query Failed: " . db_error();
    cron_debug($err);
    cron_entry(23, $err);
    exit;
}
// Loop over all projects that use the plugin
while ($row = db_fetch_array($project_res)) {
    $project = $row['unix_group_name'];
    $project_id = $row['group_id'];
    $dump_file = forge_get_config('data_path') . "/plugins/mediawiki/dumps/{$project}.xml";
    $ra = RoleAnonymous::getInstance();
    if ($ra->hasPermission('plugin_mediawiki_read', $project_id)) {
        cron_debug("Dumping {$project}...");
        $mwwrapper = forge_get_config('source_path') . "/plugins/mediawiki/bin/mw-wrapper.php";
        $tmp = tempnam(forge_get_config('data_path') . "/plugins/mediawiki/dumps/", "tmp");
        system("{$mwwrapper} {$project} dumpBackup.php --current --quiet > {$tmp}");
        chmod($tmp, 0644);
        rename($tmp, $dump_file);
    } else {
        cron_debug("Not dumping {$project} (private)...");
        if (file_exists($dump_file)) {
            unlink($dump_file);
        }
    }
}
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
Example #18
0
require_once dirname(__FILE__) . '/../../../common/include/env.inc.php';
require_once $gfcommon . 'include/pre.php';
require_once $gfcommon . 'include/cron_utils.php';
// Plugins subsystem
require_once $gfcommon . 'include/Plugin.class.php';
require_once $gfcommon . 'include/PluginManager.class.php';
setup_plugin_manager();
$group = group_get_object_by_name($fusionforgeproject);
if (!$group || $group->isError()) {
    die("Wrong group! " . ($group ? $group->getErrorMessage() : "") . "\n");
}
if (!$group->usesPlugin('mediawiki')) {
    die("Project doesn't use the Mediawiki plugin\n");
}
function ffmw_wrapper_fixup_searchpath($username)
{
    db_query_params("ALTER ROLE {$username} SET search_path = public", array());
}
register_shutdown_function('ffmw_wrapper_fixup_searchpath', forge_get_config('database_user'));
$ff_localsettings = forge_get_config('source_path') . '/www/plugins/mediawiki/LocalSettings.php';
if ($preload_localsettings) {
    define("MEDIAWIKI", true);
    require_once $ff_localsettings;
}
$src_path = forge_get_config('src_path', 'mediawiki');
$mwscript = $src_path . '/maintenance/' . $mwscript;
array_unshift($argv, $mwscript, '--conf', $ff_localsettings);
while (@ob_end_flush()) {
    /* nothing */
}
require_once $mwscript;
Example #19
0
 *
 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
 * ALONE BASIS."
 */
require_once dirname(__FILE__) . "/../../env.inc.php";
require_once $gfcommon . 'include/pre.php';
require_once forge_get_config('plugins_path') . 'wiki/common/WikiPlugin.class.php';
require_once forge_get_config('plugins_path') . 'wiki/common/wikiconfig.class.php';
// the header that displays for the user portion of the plugin
function wiki_Project_Header($params)
{
    global $id;
    $params['toptab'] = 'wiki';
    $params['group'] = $id;
    /*
        Show horizontal links
    */
    site_project_header($params);
}
$user = session_get_user();
// get the session user
if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
    exit_error("Invalid User", "Cannot Process your request for this user.");
Example #20
0
</p>
<span class="important">
 <?php 
echo _('NOTE: In some browsers you must select the file in the file-upload dialog and click "OK".  Double-clicking doesn\'t register the file.');
?>
)
</span>
<p><?php 
echo _('Upload a new file');
?>
: <input type="file" name="userfile"
 size="30" /></p>
	  <?php 
if (forge_get_config('use_manual_uploads')) {
    echo '<p>';
    printf(_('Alternatively, you can use a file you already uploaded (by SFTP or SCP) to the <a href="%2$s">project\'s incoming directory</a> (%1$s).'), $incoming, "sftp://" . forge_get_config('web_host') . $incoming . "/");
    echo ' ' . _('This direct <tt>sftp://</tt> link only works with some browsers, such as Konqueror.') . '<br />';
    $manual_files_arr = ls($incoming, true);
    if (count($manual_files_arr) > 0) {
        echo _('Choose an already uploaded file:') . '<br />';
        echo html_build_select_box_from_arrays($manual_files_arr, $manual_files_arr, 'manual_filename', '');
    } else {
        echo '<input type="hidden" name="manual_filename" value="">';
    }
    ?>
	     </p>
	  <?php 
}
?>
<p><input type="checkbox" name="logo_nuke" value="1" /><?php 
echo _("… or delete the currently uploaded logo and revert to the site default");
 public function can_show_options()
 {
     return forge_get_config('enable_compatibility_view', 'mediawiki');
 }
Example #22
0
 private function addForgeBackLinksToSidebar()
 {
     $forge_name = forge_get_config('sys_fullname');
     $added_toolbox = array();
     if ($this->isUserAnonymous()) {
         $added_toolbox[] = array('text' => $GLOBALS['Language']->getText('include_menu', 'login'), 'href' => '/account/login.php?return_to=' . $_SERVER['REQUEST_URI']);
     }
     $added_toolbox[] = array('text' => $GLOBALS['Language']->getText('plugin_mediawiki', 'back_to_forge', array($forge_name)), 'href' => '/projects/' . $GLOBALS['group']->getUnixName());
     if ($this->IsUserAdmin()) {
         $added_toolbox[] = array('text' => $GLOBALS['Language']->getText('global', 'Administration'), 'href' => '/plugins/mediawiki/forge_admin?group_id=' . $GLOBALS['group']->getId());
     }
     $this->data['sidebar'][$forge_name] = $added_toolbox;
 }