Ejemplo n.º 1
0
function upload_jsfile($idclient, $filedir, $jsfilename, $filetype)
{
    global $fm, $cfg_client, $idjsfile, $errno;
    // get the complete js-file content as string
    $functions = implode('', file($cfg_client['path'] . $filedir . $jsfilename));
    if (get_magic_quotes_gpc() != 0) {
        $functions = cms_addslashes($functions);
    }
    // create or update db-record
    // get idjsfile for existing file
    $idupl = is_duplicate_filename($idclient, $jsfilename, $filedir, 0);
    if (!empty($idupl)) {
        // js-file is existing, so update it
        $idjsfile = get_jscontent_id($idupl, $idclient);
        $tmp_data = get_jscontent_data($idjsfile, 0);
        update_jscontent($idjsfile, $functions, $tmp_data['status']);
        // update js-file record
        $fm->update_file2($tmp_data['idupl'], $idclient, $jsfilename, $filedir, $filetype, 5, $tmp_data['description'], '');
        return !empty($fm->errno);
    } else {
        // js-file is new, so create an entry in cms_upl
        $idupl = $fm->insert_file((int) $idclient, $jsfilename, $filedir, $filetype, (int) 5, '');
        if (empty($idupl)) {
            return '0703';
        }
        // insert js-file-content in cms_js
        $idjsfile = insert_jscontent($idupl, $idclient, $functions, 1, '', 0);
        if (empty($idjsfile)) {
            return '1217';
        }
    }
    return 0;
}
Ejemplo n.º 2
0
$tmp['AREA_TITLE'] = $cms_lang['area_js_edit_file'];
if ($errno) {
    $tmp['ERR_MSG'] = $cms_lang["err_{$errno}"];
}
$tmp['SUB_NAV_RIGHT'] = ' ';
// Tabellenformatierung
$tmp['TABLE_PADDING'] = $cellpadding;
$tmp['TABLE_SPACING'] = $cellspacing;
$tmp['TABLE_BORDER'] = $border;
// Templatedatei laden
$tpl->loadTemplatefile('js_edit_file.tpl');
$date_format = $cfg_cms['FormatDate'] . ' ' . $cfg_cms['FormatTime'];
// get data for editing
if (!$errno) {
    if ($idjsfile) {
        $tmp_data = get_jscontent_data($idjsfile, 1);
    }
    if ($tmp_data) {
        $jsfiledirname = $tmp_data['dirname'];
        $jsfiledescription = $tmp_data['description'];
        $jsfilecontent = $tmp_data['filecontent'];
        // handle duplicate function
        if ($action == 10) {
            $idjsfile = 0;
            $jsfilename = '';
        } else {
            $jsfilename = $tmp_data['filename'];
            $jsfilecreated = date($date_format, $tmp_data['created']);
            $jsfilelastmodified = date($date_format, $tmp_data['lastmodified']);
            $jsfileauthor = $tmp_data['name'] . ' ' . $tmp_data['surname'];
            $idjsfile = $tmp_data['idjs'];