}
// try to load flash files
$plugin['data']['files'] = returnFileListAsArray(PHPWCMS_CONTENT . 'ads/' . $plugin['data']['adcampaign_id'], 'swf');
$plugin['data']['flash'] = '';
if (is_array($plugin['data']['files']) && count($plugin['data']['files'])) {
    foreach ($plugin['data']['files'] as $_entry['value']) {
        $c = html($_entry['value']['filename']);
        $plugin['data']['flash'] .= '			<option value="' . $c . '"';
        if ($_entry['value']['filename'] == $plugin['data']['adcampaign_data']['flash']) {
            $plugin['data']['flash'] .= ' selected="selected"';
        }
        $plugin['data']['flash'] .= '>' . $c . '</option>' . LF;
    }
}
// try to load css files
$plugin['data']['files'] = returnFileListAsArray(PHPWCMS_CONTENT . 'ads/' . $plugin['data']['adcampaign_id'], 'css');
$plugin['data']['css'] = '';
if (is_array($plugin['data']['files']) && count($plugin['data']['files'])) {
    foreach ($plugin['data']['files'] as $_entry['value']) {
        $c = html($_entry['value']['filename']);
        $plugin['data']['css'] .= '			<option value="' . $c . '"';
        if ($_entry['value']['filename'] == $plugin['data']['adcampaign_data']['css']) {
            $plugin['data']['css'] .= ' selected="selected"';
        }
        $plugin['data']['css'] .= '>' . $c . '</option>' . LF;
    }
}
// as long as no ID defined hide upload content
if (empty($plugin['data']['adcampaign_id'])) {
    echo LF . '<tr><td>&nbsp;</td><td class="warning">' . $BLM['ad_info'] . '</td></tr>' . LF;
    echo LF . '<!--' . LF;
Пример #2
0
                 $oldFileHash = $rrow['f_hash'];
                 $oldFileNewHash = md5($file_name . microtime() . time());
                 // now update new file by old file information of same named
                 $nsql = "UPDATE " . DB_PREPEND . "phpwcms_file SET ";
                 $nsql .= "f_refid=" . $oldFileID . ", f_trash=5, f_size=" . $rrow['f_size'] . ', ';
                 $nsql .= "f_type=" . _dbEscape($rrow['f_type']) . ", f_changed=" . now() . ', ';
                 $nsql .= "f_hash=" . _dbEscape($oldFileNewHash) . " WHERE f_id=" . $new_fileId;
                 if (_dbQuery($nsql, 'UPDATE')) {
                     // yepp both files are updated in db
                     // now change hash of file storage files
                     rename($useruploadpath . $oldFileHash . $_file_extension, $useruploadpath . $oldFileNewHash . $_file_extension);
                     rename($usernewfile, $useruploadpath . $oldFileHash . $_file_extension);
                     // update file size of old file with new filesize
                     _dbUpdate('phpwcms_file', array('f_type' => $file_type, 'f_size' => $file_size, 'f_changed' => now()), 'f_id=' . $oldFileID);
                     // empty temp images directory
                     $thumbnails = returnFileListAsArray(PHPWCMS_THUMB, 'jpg,jpeg,gif,png');
                     if (is_array($thumbnails) && count($thumbnails)) {
                         foreach ($thumbnails as $thumbnail) {
                             @unlink(PHPWCMS_THUMB . $thumbnail['filename']);
                         }
                     }
                 }
             }
         }
         flush();
         echo $file . " [OK!]<br />";
     } else {
         echo $file . " (" . $file_error["upload"] . ")<br />";
         _dbQuery("DELETE FROM " . DB_PREPEND . "phpwcms_file WHERE f_id=" . $new_fileId . " AND f_uid=" . $_SESSION["wcs_user_id"], 'DELETE');
     }
 } else {
Пример #3
0
        if (isset($result[0])) {
            if ($jquery) {
                $data = $result;
            } else {
                foreach ($result as $value) {
                    $data[] = utf8_encode($value['cat_name']);
                }
            }
        }
        break;
    case 'lang':
        $data = is_array($phpwcms['allowed_lang']) && count($phpwcms['allowed_lang']) ? $phpwcms['allowed_lang'] : array($phpwcms['default_lang']);
        sort($data);
        break;
    case 'flush_image_cache':
        $files = returnFileListAsArray(PHPWCMS_ROOT . '/' . PHPWCMS_IMAGES, array('jpg', 'png', 'gif', 'svg'));
        $data = array('file_count' => 0, 'status' => 'ok');
        if (is_array($files)) {
            $data['file_count'] = count($files);
            foreach ($files as $file) {
                @unlink(PHPWCMS_ROOT . '/' . PHPWCMS_IMAGES . $file['filename']);
            }
        } else {
            $data['status'] = '';
        }
        break;
}
if ($method == 'json') {
    header('Content-type: application/json');
    if (!function_exists('json_encode')) {
        require PHPWCMS_ROOT . '/include/inc_ext/JSON.php';
Пример #4
0
		<tr class="jw-player">
			<td class="chatlist" align="right"><label for="fmp_set_skin"><?php 
echo $BL['be_skin'];
?>
 JW Player&#8482;:&nbsp;</label></td>
			<td><select name="fmp_set_skin">
			<option value="default"<?php 
is_selected('default', $fmp_data['fmp_set_skin']);
?>
><?php 
echo $BL['be_admin_tmpl_default'];
?>
</option>
<?php 
// skins for Flash Media Player
$skins = returnFileListAsArray(PHPWCMS_TEMPLATE . 'lib/jw_media_player/skins', 'swf,zip');
if (is_array($skins) && count($skins)) {
    foreach ($skins as $skin) {
        ?>
			<option value="<?php 
        echo $skin['filename'];
        ?>
"<?php 
        is_selected($skin['filename'], $fmp_data['fmp_set_skin']);
        ?>
><?php 
        echo html(ucwords(str_replace('_', ' ', cut_ext($skin['filename']))));
        ?>
</option>
<?php 
    }
$tmpldata = array('options' => array(), 'js' => array(), 'files' => array());
$value3 = '';
if (is_array($tmpllist) && count($tmpllist)) {
    if (empty($newsletter["newsletter_vars"]['template'])) {
        $newsletter["newsletter_vars"]['template'] = '';
    }
    $i = 0;
    foreach ($tmpllist as $value) {
        $value1 = html($value);
        $tmpldata['options'][$i] = '<option value="' . $value1 . '"';
        if ($value == $newsletter["newsletter_vars"]['template']) {
            $tmpldata['options'][$i] .= ' selected="selected"';
            $value3 = $value;
        }
        $tmpldata['options'][$i] .= '>' . $value1 . '</option>' . LF;
        $tmpldata['files'][$i] = returnFileListAsArray(PHPWCMS_TEMPLATE . 'inc_newsletter/' . $value);
        // chech against tmpl file
        if (isset($tmpldata['files'][$i]['newsletter.tmpl'])) {
            $value2 = @file_get_contents(PHPWCMS_TEMPLATE . 'inc_newsletter/' . $value . '/newsletter.tmpl');
            $value2 = get_tmpl_section('NEWSLETTER_SETTINGS', $value2);
            $value2 = parse_ini_str($value2, false);
            if (empty($value2['title'])) {
                $value2['title'] = '';
            }
            if (empty($value2['description'])) {
                $value2['description'] = '';
            }
        } else {
            $value2 = array('title' => '', 'description' => '');
        }
        $tmpldata['js'][] = '  nltemplate["' . $value . '"] = new Array();';
Пример #6
0
function phpwcms_revision_r514()
{
    $status = true;
    // do former revision check – fallback to r509
    if (phpwcms_revision_check_temp('509') !== true) {
        $status = phpwcms_revision_check('509');
    }
    // Delete
    // empty temp images table
    _dbQuery('DROP TABLE IF EXISTS ' . DB_PREPEND . 'phpwcms_imgcache', 'DROP');
    // empty temp images directory
    $thumbnails = returnFileListAsArray(PHPWCMS_THUMB, 'jpg,jpeg,gif,png');
    if (is_array($thumbnails) && count($thumbnails)) {
        foreach ($thumbnails as $thumbnail) {
            @unlink(PHPWCMS_THUMB . $thumbnail['filename']);
        }
    }
    // Set file hash
    $result = _dbQuery("SHOW FIELDS FROM " . DB_PREPEND . "phpwcms_file WHERE Field='f_hash'");
    if ($status && !empty($result[0])) {
        // Remove unused fields but only when file storage upgrade from earlier update is done
        $count = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_file LIKE 'f_thumb_%'", 'COUNT_SHOW');
        if ($count === 2) {
            $count = _dbCount("SELECT * FROM " . DB_PREPEND . "phpwcms_file WHERE f_thumb_list != '' OR f_thumb_preview != ''");
            if ($count === 0) {
                _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_file DROP f_thumb_list", 'ALTER');
                _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_file DROP f_thumb_preview", 'ALTER');
                $status = true;
            } else {
                $status = false;
            }
        }
        $result = array_change_key_case($result[0], CASE_LOWER);
        if ($status && $result['type'] == 'varchar(50)') {
            $status = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_file CHANGE f_hash f_hash VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
            // ensure all went well
            if ($status) {
                $result = _dbQuery("SHOW FIELDS FROM " . DB_PREPEND . "phpwcms_file WHERE Field='f_hash'");
                $status = false;
                if (!empty($result[0])) {
                    $result = array_change_key_case($result[0], CASE_LOWER);
                    if ($result['type'] == 'varchar(255)') {
                        $status = true;
                    }
                }
            }
        }
        // Rename Hash and files
        if ($status) {
            // Cleanup first — Check all files trashed or deleted and not yet physical accessible anymore
            $files = _dbGet('phpwcms_file', '*', 'f_trash IN (8,9) AND f_kid=1');
            if (isset($files[0]['f_id'])) {
                write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', date('Y-m-d H:i:s') . ': Prepare removing non-existing, trashed or deleted files from phpwcms_file database table' . LF, 'a');
                $file_id = array();
                foreach ($files as $file) {
                    $file['storage_name'] = $file['f_hash'];
                    if ($file['f_ext']) {
                        $file['storage_name'] .= '.' . $file['f_ext'];
                    }
                    if (!is_file(PHPWCMS_STORAGE . $file['storage_name'])) {
                        write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', date('Y-m-d H:i:s') . ': ' . json_encode($file) . LF, 'a');
                        $file_id[] = $file['f_id'];
                    }
                }
                $file_id = implode(',', $file_id);
                write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', date('Y-m-d H:i:s') . ': File IDs to be deleted (' . $file_id . ')', 'a');
                if ($file_id) {
                    $result = _dbQuery('DELETE FROM ' . DB_PREPEND . 'phpwcms_file WHERE f_trash IN (8,9) AND f_kid=1 AND f_id IN (' . $file_id . ')', 'DELETE');
                    if (!empty($result['AFFECTED_ROWS'])) {
                        write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', ' // DONE: ' . $result['AFFECTED_ROWS'] . ' deleted', 'a');
                    } else {
                        write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', ' // DONE: None deleted', 'a');
                    }
                }
                write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', LF . LF . '---' . LF . LF, 'a');
            }
            // ToDo: implement new naming
        }
    } else {
        $status = false;
    }
    return $status;
}