Ejemplo n.º 1
0
    function store()
    {
        $linksform_row = $this->getTable('videolists');
        // consume the post data with allow_html
        $data_ = JRequest::get('post', JREQUEST_ALLOWRAW);
        $data = $data_['jform'];
        $post = array();
        $listname = trim(preg_replace("/[^a-zA-Z0-9_]/", "", $data['listname']));
        $data['jform']['listname'] = $listname;
        if (!$linksform_row->bind($data)) {
            echo 'Cannot bind.';
            return false;
        }
        // Make sure the  record is valid
        if (!$linksform_row->check()) {
            echo 'Cannot check.';
            return false;
        }
        if ($linksform_row->id != 0) {
            require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php';
            $misc = new YouTubeGalleryMisc();
            $misc->videolist_row = $linksform_row;
            $misc->update_cache_table($linksform_row);
            $linksform_row->lastplaylistupdate = date('Y-m-d H:i:s');
        }
        // Store
        if (!$linksform_row->store()) {
            echo '<p>Cannot store.</p>
				<p>There is some fields missing.</p>
				';
            return false;
        }
        $this->id = $linksform_row->id;
        return true;
    }