Exemplo n.º 1
0
/**
 * Add sample category, file and document
 */
function installSampleData()
{
    global $database, $my, $mosConfig_absolute_path;
    $dmdoc = $mosConfig_absolute_path . DS . 'dmdocuments';
    $img = $mosConfig_absolute_path . DS . 'administrator' . DS . 'components' . DS . 'com_docman' . DS . 'images';
    $now = date('Y-m-d H:i:s');
    // get all super admins
    $database->setQuery("SELECT id FROM `#__users` WHERE `usertype`='Super Administrator'");
    $admins = implode(',', $database->loadResultArray());
    // add sample group
    $group = new mosDMGroups($database);
    $group->groups_name = _DML_SAMPLE_GROUP;
    $group->groups_description = _DML_SAMPLE_GROUP_DESC;
    $group->groups_access = 1;
    $group->groups_members = $admins;
    if (!$group->store()) {
        mosRedirect('index2.php?option=com_docman', 'Error: installSampleData, $groups->store()');
    }
    $groupid = -1 * $database->insertid() + _DM_PERMIT_GROUP;
    // add sample license
    $license = new mosDMLicenses($database);
    $license->name = _DML_SAMPLE_LICENSE;
    $license->license = _DML_SAMPLE_LICENSE_DESC;
    if (!$license->store()) {
        mosRedirect('index2.php?option=com_docman', 'Error: installSampleData, $license->store()');
    }
    $licenseid = $database->insertid();
    // add a sample file
    if (!file_exists($dmdoc . DS . 'sample_file.png')) {
        @copy($img . DS . 'dm_logo.png', $dmdoc . DS . _DML_SAMPLE_FILENAME);
    }
    // add sample category
    $category = new mosDMCategory($database);
    $category->parent_id = 0;
    $category->title = _DML_SAMPLE_CATEGORY;
    $category->name = _DML_SAMPLE_CATEGORY;
    $category->image = 'clock.jpg';
    $category->section = 'com_docman';
    $category->image_position = 'left';
    $category->description = _DML_SAMPLE_CATEGORY_DESC;
    $category->published = 1;
    $category->checked_out = 0;
    $category->checked_out_time = '0000-00-00 00:00:00';
    $category->editor = NULL;
    $category->ordering = 1;
    $category->access = 0;
    $category->count = 0;
    $category->params = '';
    if (!$category->store()) {
        mosRedirect('index2.php?option=com_docman', 'Error: installSampleData, $category->store()');
    }
    $catid = $database->insertId();
    // add sample document
    $doc = new mosDMDocument($database);
    $doc->catid = $catid;
    $doc->dmname = _DML_SAMPLE_DOC;
    $doc->dmdescription = _DML_SAMPLE_DOC_DESC;
    $doc->dmdate_published = $now;
    $doc->dmowner = -1;
    $doc->dmfilename = _DML_SAMPLE_FILENAME;
    $doc->published = 1;
    $doc->dmurl = '';
    $doc->dmcounter = 0;
    $doc->checked_out = 0;
    $doc->checked_out_time = '0000-00-00 00:00:00';
    $doc->approved = 1;
    $doc->dmthumbnail = '';
    $doc->dmlastupdateon = $now;
    $doc->dmlastupdateby = $my->id;
    $doc->dmsubmitedby = $my->id;
    $doc->dmmantainedby = $groupid;
    $doc->dmlicense_id = $licenseid;
    $doc->dmlicense_display = 1;
    $doc->access = 0;
    $doc->attribs = 'crc_checksum=\\nmd5_checksum=';
    if (!$doc->store()) {
        mosRedirect('index2.php?option=com_docman', 'Error: installSampleData, $doc->store()');
    }
    mosRedirect('index2.php?option=com_docman', _DML_SAMPLE_COMPLETED);
}
Exemplo n.º 2
0
 function DOCMAN_Category($id)
 {
     $this->objDBTable =& mosDMCategory::getInstance($id);
     $this->_format($this->objDBTable);
 }
Exemplo n.º 3
0
 function categoryParentList($id, $action, $options = array())
 {
     global $_DOCMAN;
     $database = JFactory::getDBO();
     require_once $_DOCMAN->getPath('classes', 'utils');
     $list = DOCMAN_utils::categoryArray();
     // using getInstance for performance
     // $cat = new mosDMCategory($database);
     // $cat->load($id);
     $cat =& mosDMCategory::getInstance($id);
     $this_treename = '';
     foreach ($list as $item) {
         if ($this_treename) {
             if ($item->id != $cat->id && strpos($item->treename, $this_treename) === false) {
                 $options[] = JHTML::_('select.option', $item->id, $item->treename);
             }
         } else {
             if ($item->id != $cat->id) {
                 $options[] = JHTML::_('select.option', $item->id, $item->treename);
             } else {
                 $this_treename = "{$item->treename}/";
             }
         }
     }
     $parent = JHTML::_('select.genericlist', $options, 'parent_id', 'class="inputbox" size="1"', 'value', 'text', $cat->parent_id);
     return $parent;
 }
Exemplo n.º 4
0
/**
* changes the access level of a record
*
* @param integer $ The increment to reorder by
*/
function accessCategory($uid, $access)
{
    DOCMAN_token::check() or die('Invalid Token');
    $database = JFactory::getDBO();
    $mainframe = JFactory::getApplication();
    $row = new mosDMCategory($database);
    $row->load($uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    $mainframe->redirect('index.php?option=com_docman&section=categories');
}
Exemplo n.º 5
0
 /**
  * @desc 	Transform the document to a object if necessary
  * @param 	mixed	object or numeric $category
  * @access  	private
  * @return 	object 	a document object
  */
 function isCategory(&$category)
 {
     $database = JFactory::getDBO();
     // check to see if we have a object
     if (!is_a($category, 'mosDMCategory')) {
         // try to create a category db object
         if (is_object($category)) {
             $id = (int) @$category->id;
         } else {
             $id = (int) $category;
         }
         $category =& mosDMCategory::getInstance($id);
     }
     return $category;
 }
Exemplo n.º 6
0
function copyDocumentProcess($cid)
{
    DOCMAN_token::check() or die('Invalid Token');
    $mainframe = JFactory::getApplication();
    $database = JFactory::getDBO();
    $my = JFactory::getUser();
    // get the id of the category to copy the document to
    $categoryCopy = JRequest::getInt('catid', '', 'post');
    // preform move
    $doc = new mosDMDocument($database);
    $doc->copy($cid, $categoryCopy);
    // output status message
    $cids = implode(',', $cid);
    $total = count($cid);
    $cat = new mosDMCategory($database);
    $cat->load($categoryCopy);
    $msg = $total . ' ' . _DML_DOCUMENTS_COPIED_TO . ' ' . $cat->name;
    $mainframe->redirect('index.php?option=com_docman&section=documents', $msg);
}
Exemplo n.º 7
0
/**
 * Add sample category, file and document
 */
function installSampleData()
{
    $database = JFactory::getDBO();
    $my = JFactory::getUser();
    $mainframe = JFactory::getApplication();
    $dmdoc = JPATH_ROOT . DS . _DM_DEFAULT_DATA_FOLDER;
    $img = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_docman' . DS . 'images';
    $now = date('Y-m-d H:i:s');
    // get all super admins
    $database->setQuery("SELECT id FROM `#__users` WHERE `usertype`='Super Administrator'");
    $admins = implode(',', $database->loadResultArray());
    // add sample group
    $group = new mosDMGroups($database);
    $group->groups_name = _DML_SAMPLE_GROUP;
    $group->groups_description = _DML_SAMPLE_GROUP_DESC;
    $group->groups_access = 1;
    $group->groups_members = $admins;
    if (!$group->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $groups->store()');
    }
    $groupid = -1 * $database->insertid() + _DM_PERMIT_GROUP;
    // add sample license
    $license = new mosDMLicenses($database);
    $license->name = _DML_SAMPLE_LICENSE;
    $license->license = _DML_SAMPLE_LICENSE_DESC;
    if (!$license->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $license->store()');
    }
    $licenseid = $database->insertid();
    // add a sample file
    //if ( !file_exists($dmdoc.DS.'sample_file.png')) {
    //   @copy($img.DS.'dm_logo.png', $dmdoc.DS._DML_SAMPLE_FILENAME);
    //}
    // add sample category
    $category = new mosDMCategory($database);
    $category->parent_id = 0;
    $category->title = 'DOCman Sample Data';
    $category->name = 'DOCman Sample Data';
    $category->image = '';
    $category->section = 'com_docman';
    $category->image_position = 'left';
    $category->description = '<p>Congratulations on installing DOCman! This is a category with some sample documents, so you can get a feel of how DOCman works. Did you know you can have unlimited nested categories? Just give it a try!</p>';
    $category->published = 1;
    $category->checked_out = 0;
    $category->checked_out_time = '0000-00-00 00:00:00';
    $category->editor = NULL;
    $category->ordering = 1;
    $category->access = 0;
    $category->count = 0;
    $category->params = '';
    if (!$category->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $category->store()');
    }
    $catid = $database->insertId();
    // add sample document
    $doc = new mosDMDocument($database);
    $doc->catid = $catid;
    $doc->dmname = 'About DOCman 1.5';
    $doc->dmdescription = '<p>Short presentation about DOCman 1.5</p>';
    $doc->dmdate_published = $now;
    $doc->dmowner = -1;
    $doc->dmfilename = 'Link: http://www.box.net/shared/static/kvxyc2jjk0.pdf';
    $doc->published = 1;
    $doc->dmurl = 'http://www.joomlatools.eu';
    $doc->dmcounter = 0;
    $doc->checked_out = 0;
    $doc->checked_out_time = '0000-00-00 00:00:00';
    $doc->approved = 1;
    $doc->dmthumbnail = '';
    $doc->dmlastupdateon = $now;
    $doc->dmlastupdateby = $my->id;
    $doc->dmsubmitedby = $my->id;
    $doc->dmmantainedby = $groupid;
    $doc->dmlicense_id = $licenseid;
    $doc->dmlicense_display = 1;
    $doc->access = 0;
    $doc->attribs = '';
    if (!$doc->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $doc->store()');
    }
    // ... and another
    $doc = new mosDMDocument($database);
    $doc->catid = $catid;
    $doc->dmname = 'What is Nooku Framework?';
    $doc->dmdescription = '<p>What is Nooku Framework? Get a very quick introduction about the new engine you can plug into Joomla. Build better extensions with less code!</p>';
    $doc->dmdate_published = $now;
    $doc->dmowner = -1;
    $doc->dmfilename = 'Link: http://www.box.net/shared/static/pqsjzv0rko.pdf';
    $doc->published = 1;
    $doc->dmurl = 'http://www.nooku.org/framework';
    $doc->dmcounter = 0;
    $doc->checked_out = 0;
    $doc->checked_out_time = '0000-00-00 00:00:00';
    $doc->approved = 1;
    $doc->dmthumbnail = '';
    $doc->dmlastupdateon = $now;
    $doc->dmlastupdateby = $my->id;
    $doc->dmsubmitedby = $my->id;
    $doc->dmmantainedby = $groupid;
    $doc->dmlicense_id = $licenseid;
    $doc->dmlicense_display = 1;
    $doc->access = 0;
    $doc->attribs = '';
    if (!$doc->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $doc->store()');
    }
    $mainframe->redirect('index.php?option=com_docman', _DML_SAMPLE_COMPLETED);
}
Exemplo n.º 8
0
function copyDocumentProcess($cid)
{
    DOCMAN_token::check() or die('Invalid Token');
    global $database, $my;
    // get the id of the category to copy the document to
    $categoryCopy = mosGetParam($_POST, 'catid', '');
    // preform move
    $doc = new mosDMDocument($database);
    $doc->copy($cid, $categoryCopy);
    // output status message
    $cids = implode(',', $cid);
    $total = count($cid);
    $cat = new mosDMCategory($database);
    $cat->load($categoryCopy);
    $msg = $total . ' ' . _DML_DOCUMENTS_COPIED_TO . ' ' . $cat->name;
    mosRedirect('index2.php?option=com_docman&section=documents', $msg);
}
Exemplo n.º 9
0
/**
* changes the access level of a record
*
* @param integer $ The increment to reorder by
*/
function accessCategory($uid, $access)
{
    DOCMAN_token::check() or die('Invalid Token');
    global $database;
    $row = new mosDMCategory($database);
    $row->load($uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    mosRedirect('index2.php?option=com_docman&section=categories');
}
Exemplo n.º 10
0
/**
 * Add sample category, file and document
 */
function installSampleData()
{
    $database = JFactory::getDBO();
    $my = JFactory::getUser();
    $mainframe = JFactory::getApplication();
    $dmdoc = JPATH_ROOT . DS . _DM_DEFAULT_DATA_FOLDER;
    $img = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_docman' . DS . 'images';
    $now = date('Y-m-d H:i:s');
    // get all super admins
    $database->setQuery("SELECT id FROM `#__users` WHERE `usertype`='Super Administrator'");
    $admins = implode(',', $database->loadResultArray());
    // add sample group
    $group = new mosDMGroups($database);
    $group->groups_name = _DML_SAMPLE_GROUP;
    $group->groups_description = _DML_SAMPLE_GROUP_DESC;
    $group->groups_access = 1;
    $group->groups_members = $admins;
    if (!$group->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $groups->store()');
    }
    $groupid = -1 * $database->insertid() + _DM_PERMIT_GROUP;
    // add sample license
    $license = new mosDMLicenses($database);
    $license->name = _DML_SAMPLE_LICENSE;
    $license->license = _DML_SAMPLE_LICENSE_DESC;
    if (!$license->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $license->store()');
    }
    $licenseid = $database->insertid();
    // add a sample file
    //if ( !file_exists($dmdoc.DS.'sample_file.png')) {
    //   @copy($img.DS.'dm_logo.png', $dmdoc.DS._DML_SAMPLE_FILENAME);
    //}
    // add sample category
    $category = new mosDMCategory($database);
    $category->parent_id = 0;
    $category->title = 'DOCman Sample Data';
    $category->name = 'DOCman Sample Data';
    $category->image = '';
    $category->section = 'com_docman';
    $category->image_position = 'left';
    $category->description = '<p>Congratulations on installing DOCman! This is a category with some sample documents, so you can get a feel of how DOCman works. Did you know you can have unlimited nested categories? Just give it a try!</p>';
    $category->published = 1;
    $category->checked_out = 0;
    $category->checked_out_time = '0000-00-00 00:00:00';
    $category->editor = NULL;
    $category->ordering = 1;
    $category->access = 0;
    $category->count = 0;
    $category->params = '';
    if (!$category->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $category->store()');
    }
    $catid = $database->insertId();
    // add sample document
    $doc = new mosDMDocument($database);
    $doc->catid = $catid;
    $doc->dmname = 'About DOCman 1.5';
    $doc->dmdescription = '<p>Short presentation about DOCman 1.5</p>';
    $doc->dmdate_published = $now;
    $doc->dmowner = -1;
    $doc->dmfilename = 'Link: http://www.box.net/shared/static/kvxyc2jjk0.pdf';
    $doc->published = 1;
    $doc->dmurl = 'http://www.joomlatools.eu';
    $doc->dmcounter = 0;
    $doc->checked_out = 0;
    $doc->checked_out_time = '0000-00-00 00:00:00';
    $doc->approved = 1;
    $doc->dmthumbnail = '';
    $doc->dmlastupdateon = $now;
    $doc->dmlastupdateby = $my->id;
    $doc->dmsubmitedby = $my->id;
    $doc->dmmantainedby = $groupid;
    $doc->dmlicense_id = $licenseid;
    $doc->dmlicense_display = 1;
    $doc->access = 0;
    $doc->attribs = '';
    if (!$doc->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $doc->store()');
    }
    // ... and another
    $doc = new mosDMDocument($database);
    $doc->catid = $catid;
    $doc->dmname = 'Nooku Framework: A new brain for Joomla';
    $doc->dmdescription = "<p>At the core of Joomla, there's a framework. It's the engine that powers all of Joomla, and a lot of the third-party extensions. It's great platform, but sites today are more demanding, and extensions require more power. We felt it was time to build <strong>a new brain for Joomla</strong>.</p><p><a href='http://nooku.org/framework'>Nooku Framework</a> can be installed in Joomla as a plugin. As a developer, you can now build your extensions using Nooku's intuitive API. Because the framework handles most of the work, you'll need only a <strong>fraction of the amount of code</strong>. You can focus on what really matters: business logic and the user experience.</p><p>But there's more: Nooku Framework provides you with excellent out-of-the-box <strong>security features</strong>. The great <strong>design patterns</strong> based architecture makes your extension very flexible: all your code automatically becomes re-usable, extensible and replaceable. We believe Nooku Framework is the boost Joomla needs to keep competing.</p>";
    $doc->dmdate_published = $now;
    $doc->dmowner = -1;
    $doc->dmfilename = 'Link: http://www.box.net/shared/static/pqsjzv0rko.pdf';
    $doc->published = 1;
    $doc->dmurl = 'http://www.nooku.org/framework';
    $doc->dmcounter = 0;
    $doc->checked_out = 0;
    $doc->checked_out_time = '0000-00-00 00:00:00';
    $doc->approved = 1;
    $doc->dmthumbnail = '';
    $doc->dmlastupdateon = $now;
    $doc->dmlastupdateby = $my->id;
    $doc->dmsubmitedby = $my->id;
    $doc->dmmantainedby = $groupid;
    $doc->dmlicense_id = $licenseid;
    $doc->dmlicense_display = 1;
    $doc->access = 0;
    $doc->attribs = '';
    if (!$doc->store()) {
        $mainframe->redirect('index.php?option=com_docman', 'Error: installSampleData, $doc->store()');
    }
    $mainframe->redirect('index.php?option=com_docman', _DML_SAMPLE_COMPLETED);
}