コード例 #1
0
ファイル: site_upgrade.php プロジェクト: ariep/ZenPhoto20-DEV
/**
 * updates the site status
 * @param string $state
 */
function setSiteState($state, $folder = NULL)
{
    if (is_null($folder)) {
        $folder = SERVERPATH . '/';
    }
    $_configMutex = new zpMutex('cF', NULL, $folder);
    $_configMutex->lock();
    $zp_cfg = @file_get_contents($folder . DATA_FOLDER . '/' . CONFIGFILE);
    $zp_cfg = updateConfigItem('site_upgrade_state', $state, $zp_cfg);
    storeConfig($zp_cfg, $folder);
    $_configMutex->unlock();
}
コード例 #2
0
ファイル: full-image.php プロジェクト: ariep/ZenPhoto20-DEV
     if (SYMLINK && @symlink($image_path, $cache_path)) {
         if (DEBUG_IMAGE) {
             debugLog("full-image:symlink original " . basename($image));
         }
         clearstatcache();
     } else {
         if (@copy($image_path, $cache_path)) {
             if (DEBUG_IMAGE) {
                 debugLog("full-image:copy original " . basename($image));
             }
             clearstatcache();
         }
     }
 } else {
     //	have to create the image
     $iMutex = new zpMutex('i', getOption('imageProcessorConcurrency'));
     $iMutex->lock();
     $newim = zp_imageGet($image_path);
     if ($rotate) {
         $newim = zp_rotateImage($newim, $rotate);
     }
     if ($watermark_use_image) {
         $watermark_image = getWatermarkPath($watermark_use_image);
         if (!file_exists($watermark_image)) {
             $watermark_image = SERVERPATH . '/' . ZENFOLDER . '/images/imageDefault.png';
         }
         $offset_h = getOption('watermark_h_offset') / 100;
         $offset_w = getOption('watermark_w_offset') / 100;
         $watermark = zp_imageGet($watermark_image);
         $watermark_width = zp_imageWidth($watermark);
         $watermark_height = zp_imageHeight($watermark);
コード例 #3
0
        if ($__time - $v < 3600) {
            //only the within the last 10 minutes
            if ($__count > 0) {
                $__interval = $__interval + ($v - $__previous);
            }
            $__count++;
        } else {
            $element = NULL;
        }
        $__previous = $v;
    }
}
if (OFFSET_PATH) {
    zp_register_filter('admin_tabs', 'accessThreshold::admin_tabs');
} else {
    $mu = new zpMutex('aT');
    $mu->lock();
    $recentIP = getSerializedArray(@file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/recentIP'));
    if (array_key_exists('config', $recentIP)) {
        $__time = time();
        $__config = $recentIP['config'];
        if (!isset($__config['accessThreshold_LocaleCount'])) {
            $__config['accessThreshold_LocaleCount'] = 5;
        }
        $full_ip = getUserIP();
        if (strpos($full_ip, '.') === false) {
            //ip v6
            $separator = ':';
        } else {
            $separator = '.';
        }
コード例 #4
0
<?php

/**
 * Used to set the mod_rewrite option.
 * This script is accessed via a /page/setup_set-mod_rewrite?z=setup.
 * It will not be found unless mod_rewrite is working.
 *
 * @author Stephen Billard (sbillard)
 *
 * @package setup
 *
 */
require_once dirname(dirname(__FILE__)) . '/functions-basic.php';
require_once dirname(__FILE__) . '/setup-functions.php';
$iMutex = new zpMutex('i', getOption('imageProcessorConcurrency'));
$iMutex->lock();
$mod_rewrite = MOD_REWRITE;
if (is_null($mod_rewrite)) {
    $msg = gettext('The option “mod_rewrite” will be set to “enabled”.');
    setOption('mod_rewrite', 1);
} else {
    if ($mod_rewrite) {
        $msg = gettext('The option “mod_rewrite” is “enabled”.');
    } else {
        $msg = gettext('The option “mod_rewrite” is “disabled”.');
    }
}
setOption('mod_rewrite_detected', 1);
setupLog(gettext('Notice: “Module mod_rewrite” is working.') . ' ' . $msg, true);
$fp = fopen(SERVERPATH . '/' . ZENFOLDER . '/images/pass.png', 'rb');
// send the right headers
コード例 #5
0
ファイル: index.php プロジェクト: ariep/ZenPhoto20-DEV
if (!function_exists("gettext")) {
    require_once dirname(dirname(__FILE__)) . '/lib-gettext/gettext.inc';
    $noxlate = -1;
} else {
    $noxlate = 1;
}
if (version_compare(PHP_VERSION, PHP_MIN_VERSION, '<')) {
    die(sprintf(gettext('ZenPhoto20 requires PHP version %s or greater'), PHP_MIN_VERSION));
}
$chmod = fileperms(dirname(dirname(__FILE__))) & 0666;
$_initial_session_path = session_save_path();
require_once dirname(dirname(__FILE__)) . '/global-definitions.php';
require_once dirname(dirname(__FILE__)) . '/functions-common.php';
require_once dirname(__FILE__) . '/setup-functions.php';
//allow only one setup to run
$setupMutex = new zpMutex('sP');
$setupMutex->lock();
if ($debug = isset($_REQUEST['debug'])) {
    if (!($debug = $_REQUEST['debug'])) {
        $debug = true;
    }
}
$upgrade = false;
require_once dirname(dirname(__FILE__)) . '/lib-utf8.php';
if (isset($_REQUEST['autorun'])) {
    if (!empty($_REQUEST['autorun'])) {
        $autorun = strip_tags($_REQUEST['autorun']);
    } else {
        $autorun = 'admin';
    }
} else {
コード例 #6
0
 /**
  *
  * This method establishes the current set of database fields. It will add the
  * fields to the database if they are not already present. Fields from previous
  * constructor calls that are no longer in the list will be removed from the
  * database (along with any data associated with them.)
  *
  * @param array $newfields
  */
 function constructor($me, $newfields)
 {
     $database = array();
     foreach (getDBTables() as $table) {
         $tablecols = db_list_fields($table);
         foreach ($tablecols as $key => $datum) {
             $database[$table][$datum['Field']] = $datum;
         }
     }
     $current = $fields = $searchDefault = array();
     if (extensionEnabled($me)) {
         //need to update the database tables.
         foreach ($newfields as $newfield) {
             $table = $newfield['table'];
             $name = $newfield['name'];
             if (!($existng = isset($database[$table][$name]))) {
                 if (isset($newfield['searchDefault']) && $newfield['searchDefault']) {
                     $searchDefault[] = $name;
                 }
             }
             if (is_null($newfield['type'])) {
                 if ($name == 'tags') {
                     setOption('adminTagsTab', 1);
                 }
             } else {
                 switch (strtolower($newfield['type'])) {
                     default:
                         $dbType = strtoupper($newfield['type']);
                         break;
                     case 'int':
                         $dbType = strtoupper($newfield['type']) . '(' . min(255, $newfield['size']) . ')';
                         if (isset($newfield['attribute'])) {
                             $dbType .= ' ' . $newfield['attribute'];
                             unset($newfield['attribute']);
                         }
                         break;
                     case 'varchar':
                         $dbType = strtoupper($newfield['type']) . '(' . min(255, $newfield['size']) . ')';
                         break;
                 }
                 if ($existng) {
                     if (strtoupper($database[$table][$name]['Type']) != $dbType || empty($database[$table][$name]['Comment'])) {
                         $cmd = ' CHANGE `' . $name . '`';
                     } else {
                         $cmd = NULL;
                     }
                     unset($database[$table][$name]);
                 } else {
                     $cmd = ' ADD COLUMN';
                 }
                 $sql = 'ALTER TABLE ' . prefix($newfield['table']) . $cmd . ' `' . $name . '` ' . $dbType;
                 if (isset($newfield['attribute'])) {
                     $sql .= ' ' . $newfield['attribute'];
                 }
                 if (isset($newfield['default'])) {
                     $sql .= ' DEFAULT ' . $newfield['default'];
                 }
                 $sql .= " COMMENT 'optional_{$me}'";
                 if ((!$cmd || setupQuery($sql)) && in_array($newfield['table'], array('albums', 'images', 'news', 'news_categories', 'pages'))) {
                     $fields[] = strtolower($newfield['name']);
                 }
                 $current[$newfield['table']][$newfield['name']] = $dbType;
             }
         }
         setOption(get_class($this) . '_addedFields', serialize($current));
         if (!empty($searchDefault)) {
             $fieldExtenderMutex = new zpMutex('fE');
             $fieldExtenderMutex->lock();
             $engine = new SearchEngine();
             $set_fields = $engine->allowedSearchFields();
             $set_fields = array_unique(array_merge($set_fields, $searchDefault));
             setOption('search_fields', implode(',', $set_fields));
             $fieldExtenderMutex->unlock();
         }
     } else {
         purgeOption(get_class($this) . '_addedFields');
     }
     foreach ($database as $table => $fields) {
         //drop fields no longer defined
         foreach ($fields as $field => $orphaned) {
             if ($orphaned['Comment'] == "optional_{$me}") {
                 $sql = 'ALTER TABLE ' . prefix($table) . ' DROP `' . $field . '`';
                 setupQuery($sql);
             }
         }
     }
 }