~dangarner/xibo/server-layout-media-permissions

« back to all changes in this revision

Viewing changes to server/lib/modules/module.class.php

  • Committer: Dan Garner
  • Date: 2011-08-11 18:07:32 UTC
  • Revision ID: dan@xibo.org.uk-20110811180732-adglmvp36ay2h2r3
[server] Replacing media lost the security settings

Show diffs side-by-side

added added

removed removed

Lines of Context:
906
906
            $save_button = <<<END
907
907
            <input id="btnSave" type="submit" value="Save" />
908
908
            <input class="XiboFormButton" id="btnCancel" type="button" title="Return to the Region Options" href="index.php?p=layout&layoutid=$layoutid&regionid=$regionid&q=RegionOptions" value="Cancel" />
909
 
            <input class="XiboFormButton" type="button" href="index.php?p=content&q=LibraryAssignForm&layoutid=$layoutid&regionid=$regionid" title="Library" value="Library" />
910
909
END;
911
910
        }
912
911
        elseif ($regionid != '' && !$this->showRegionOptions)
1284
1283
            $SQL  = "INSERT INTO media (name, type, duration, originalFilename, userID, retired ) ";
1285
1284
            $SQL .= "VALUES ('%s', '$this->type', '%s', '%s', %d, 0) ";
1286
1285
 
1287
 
            $SQL = sprintf($SQL, $db->escape_string($name), $db->escape_string($duration), $db->escape_string($fileName), $userid);
 
1286
            $SQL = sprintf($SQL, $db->escape_string($name), $db->escape_string($this->duration), $db->escape_string($fileName), $userid);
1288
1287
 
1289
1288
            if (!$new_mediaid = $db->insert_query($SQL))
1290
1289
            {
1341
1340
                $this->response->keepOpen = true;
1342
1341
                return $this->response;
1343
1342
            }
 
1343
 
 
1344
            // We need to assign all permissions for the old media id to the new media id
 
1345
            Kit::ClassLoader('mediagroupsecurity');
 
1346
 
 
1347
            $security = new MediaGroupSecurity($db);
 
1348
            $security->Copy($mediaid, $new_mediaid);
 
1349
 
 
1350
            // Are we on a region
 
1351
            if ($regionid != '')
 
1352
            {
 
1353
                Kit::ClassLoader('layoutmediagroupsecurity');
 
1354
 
 
1355
                $security = new LayoutMediaGroupSecurity($db);
 
1356
                $security->Copy($layoutid, $regionid, $mediaid, $new_mediaid);
 
1357
            }
1344
1358
        }
1345
1359
        else
1346
1360
        {