コード例 #1
0
ファイル: router.core.php プロジェクト: solyfast/littlebit-fw
 private function startRouter()
 {
     $uri = $this->getURI();
     if (!empty($uri)) {
         //create file path
         $file = dirName(__FILE__) . "/../components/" . strtolower($this->uri['component']) . ".component.php";
         //check if component exists
         if (file_exists($file)) {
             require_once $file;
             //create component name (cName) and component action (cAction), call with cParameters
             $this->cName = "component" . $this->uri['component'];
             $this->cAction = "action" . $this->uri['action'];
             $this->cParameters = $this->uri['parameters'];
             //create object and call method
             if (isset($this->cParameters)) {
                 if (class_exists($this->cName) and $component = new $this->cName($this->uri) and method_exists($component, $this->cAction) and $action = $this->cAction) {
                     $component->{$action}($this->cParameters);
                 } else {
                     if (class_exists($this->cName) and $component = new $this->cName($this->uri) and method_exists($component, $this->cAction) and $action = $this->cAction) {
                         $component->{$action}();
                     }
                 }
             }
             //return true if all was executed
             return true;
         }
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: gs_utf_normal.php プロジェクト: rkania/GS3
function _gs_utf8_get_map()
{
    $map = array();
    $lines = @file(dirName(__FILE__) . '/Translit.txt');
    if (!is_array($lines)) {
        return $map;
    }
    foreach ($lines as $line) {
        $line = trim($line);
        if ($line == '' || subStr($line, 0, 1) == '#') {
            continue;
        }
        $tmp = explode(';', $line, 3);
        $char = rTrim(@$tmp[0]);
        $translit = trim(@$tmp[1]);
        if (!$translit) {
            $map[$char] = '';
        } else {
            $char = hexUnicodeToUtf8($char);
            $tmp = @preg_split('/\\s+/S', $translit);
            if (!is_array($tmp)) {
                continue;
            }
            $t = '';
            foreach ($tmp as $translit) {
                $t .= hexUnicodeToUtf8($translit);
            }
            $map[$char] = $t;
        }
    }
    return $map;
}
コード例 #3
0
ファイル: RedirectTest.php プロジェクト: visor/nano
 protected function setUp()
 {
     $this->app->backup();
     $application = new \Nano\Application();
     $application->withConfigurationFormat('php')->withRootDir(dirName(dirName(dirName(__DIR__))) . DS . 'application-example')->configure();
     $this->redirect = new \Nano\Controller\Redirect(new \Nano\Controller\Response($application));
 }
コード例 #4
0
function Controller($module, $defaultMode = "default", $modeField = "", $params = array())
{
    $path = dirName(__FILE__);
    $mode = $defaultMode;
    if ($modeField == "") {
        $modeField = $module . "_mode";
    }
    if (!is_dir($path . "/" . $module)) {
        die("Module " . $path . "/" . $module . " not found in {$path}.");
    }
    if (array_key_exists($modeField, $_POST)) {
        $mode = $_POST[$modeField];
    } elseif (array_key_exists($modeField, $_GET)) {
        $mode = $_GET[$modeField];
    }
    # include module file for any params
    $paramsPath = $path . "/" . $module . "/module-params.php";
    if (file_exists($paramsPath)) {
        include $paramsPath;
    }
    # include model file from processing / getting data
    $lastMode = "";
    while ($lastMode != $mode) {
        $lastMode = $mode;
        $actionPath = $path . "/" . $module . "/action/" . $mode . ".php";
        if (file_exists($actionPath)) {
            include $actionPath;
        }
    }
    # include view file for displaying data
    $viewPath = $path . "/" . $module . "/view/" . $mode . ".php";
    if (file_exists($viewPath)) {
        include $viewPath;
    }
}
コード例 #5
0
 public static function language($language)
 {
     $dir = dirName(__FILE__) . "/../language/";
     $file = $language . ".language.php";
     if (file_exists($dir . $file)) {
         require_once $dir . $file;
     }
 }
コード例 #6
0
ファイル: Files.php プロジェクト: visor/nano
 /**
  * @return string
  * @param \Nano\TestUtils\TestCase $test
  * @param string $name
  * @param string|null $anotherDir
  */
 public function get(\Nano\TestUtils\TestCase $test, $name, $anotherDir = null)
 {
     $class = new \ReflectionClass($test);
     $name = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $name);
     $result = dirName($class->getFileName());
     if (null !== $anotherDir) {
         $result .= str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $anotherDir);
     }
     return $result . DIRECTORY_SEPARATOR . '_files' . $name;
 }
コード例 #7
0
ファイル: ScriptInfoTest.php プロジェクト: visor/nano
 protected function setUp()
 {
     $this->app->backup();
     ob_start();
     $this->setUseOutputBuffering(true);
     $this->appRoot = dirName(__DIR__) . '/Application/_files';
     $this->cwd = getCwd();
     $this->cli = new \Nano\Cli();
     chDir($this->appRoot);
     $this->cli->run(array());
 }
コード例 #8
0
ファイル: CommonTest.php プロジェクト: visor/nano
 protected function setUp()
 {
     $this->app->backup();
     ob_start();
     $this->setUseOutputBuffering(true);
     $application = new \Nano\Application();
     $application->withRootDir($GLOBALS['application']->rootDir)->withConfigurationFormat('php')->configure();
     $this->appRoot = dirName(__DIR__) . '/Application/_files';
     $this->nanoRoot = $application->nanoRootDir;
     $this->cwd = getCwd();
     $this->cli = new \Nano\Cli();
     chDir($this->appRoot);
 }
コード例 #9
0
<?php

/**
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright 2014 Akvelon Inc.
* http://www.akvelon.com/contact-us
*/
require_once realpath(dirName(__FILE__) . '/../bootstrap_base.php');
require_once KALTURA_ROOT_PATH . '/api_v3/lib/KalturaErrors.php';
require_once KALTURA_ROOT_PATH . '/vendor/autoload.php';
use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Common\Internal\MediaServicesSettings;
use WindowsAzure\MediaServices\Models\Asset;
use WindowsAzure\MediaServices\Models\AccessPolicy;
use WindowsAzure\MediaServices\Models\Locator;
use WindowsAzure\MediaServices\Models\Task;
use WindowsAzure\MediaServices\Models\Job;
use WindowsAzure\Common\Internal\Http\Url;
use WindowsAzure\Common\Internal\Resources;
/**
 * Provides interface for access to Microsoft Azure Media Services
 * @package infra
 * @subpackage utils
 */
class kWAMS
{
コード例 #10
0
ファイル: init-migrate.php プロジェクト: studio-v/nano
<?php

require dirName(__DIR__) . '/library/Nano.php';
Nano::instance();
$database = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : null;
Nano_Migrate_Init::init(Nano::db($database));
コード例 #11
0
function gs_ringtone_set($user, $src, $bellcore, $change_file = false, $file = null)
{
    if (!preg_match('/^[a-zA-Z\\d]+$/', $user)) {
        return new GsError('User must be alphanumeric.');
    }
    if (!in_array($src, array('internal', 'external'), true)) {
        return new GsError('Source must be internal|external.');
    }
    $bellcore = (int) $bellcore;
    if ($bellcore < 0 || $bellcore > 10) {
        return new GsError('Bellcore must be between 1 and 10 or 0 for silent.');
    }
    if (!$change_file) {
        $file = null;
    } else {
        if (!$file) {
            # to remove a custom ringer
            $file = null;
        } else {
            $file = @realPath($file);
            if (!@file_exists($file)) {
                $file = @realPath(@$_ENV['PWD'] . '/' . $file);
                if (!@file_exists($file)) {
                    return new GsError('File not found.');
                }
            }
            //if (strToLower(subStr($file,-4)) != '.mp3')
            //	return new GsError( 'File is not an mp3.' );
        }
    }
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # get user_id
    #
    $user_id = (int) $db->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $db->escape($user) . '\'');
    if (!$user_id) {
        return new GsError('Unknown user.');
    }
    # make sure there is an entry in the db and set the bellcore ringer
    #
    $num = (int) $db->executeGetOne('SELECT COUNT(*) `num` FROM `ringtones` WHERE `user_id`=' . $user_id . ' AND `src`=\'' . $src . '\'');
    if ($num < 1) {
        $ok = $db->execute('INSERT INTO `ringtones` (`user_id`, `src`, `bellcore`, `file`) VALUES (' . $user_id . ', \'' . $src . '\', ' . $bellcore . ', NULL)');
    } else {
        $ok = $db->execute('UPDATE `ringtones` SET `bellcore`=' . $bellcore . ' WHERE `user_id`=' . $user_id . ' AND `src`=\'' . $src . '\'');
    }
    if (!$ok) {
        return new GsError('DB error.');
    }
    if (!$change_file) {
        return true;
    }
    # are we the web server?
    #
    if (!gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
        $our_host_ips = @gs_get_listen_to_ips();
        if (!is_array($our_host_ips)) {
            return new GsError('Failed to get our host IPs.');
        }
        $we_are_the_webserver = in_array(GS_PROV_HOST, $our_host_ips);
    } else {
        $we_are_the_webserver = true;
    }
    # remove old ringer from htdocs/prov/ringtones/ dir
    #
    if ($we_are_the_webserver) {
        # local
        @exec('sudo rm -rf ' . GS_DIR . 'htdocs/prov/ringtones/' . $user . '-' . subStr($src, 0, 3) . '-* 1>>/dev/null 2>>/dev/null');
    } else {
        # remotely
        $cmd = 'rm -rf /opt/gemeinschaft/htdocs/prov/ringtones/' . $user . '-' . subStr($src, 0, 3) . '-* 1>>/dev/null 2>>/dev/null &';
        @exec('sudo ssh -o StrictHostKeyChecking=no -o BatchMode=yes ' . qsa('root@' . GS_PROV_HOST) . ' ' . qsa($cmd) . ' 1>>/dev/null 2>>/dev/null');
    }
    # just remove custom ringer?
    #
    if (!$file) {
        $ok = $db->execute('UPDATE `ringtones` SET `file`=NULL WHERE `user_id`=' . $user_id . ' AND `src`=\'' . $src . '\'');
        if (!$ok) {
            return new GsError('DB error.');
        }
        return true;
    }
    # convert sound file to the formats needed for each phone type
    #
    $to_sox_format = array('alaw' => 'al', 'ulaw' => 'ul');
    $pinfo = pathInfo($file);
    //$base = $pinfo['basename'];
    $ext = strToLower(@$pinfo['extension']);
    if (array_key_exists($ext, $to_sox_format)) {
        $ext = $to_sox_format[$ext];
    }
    $rand = base_convert(rand(1296, 46655), 10, 36);
    # 100(36) - zzz(36)
    $tmpbase = '/tmp/gs-ring-' . $user . '-' . $rand;
    $infile = $tmpbase . '-in.' . $ext;
    $outbase = $tmpbase . '-out';
    $ok = @copy($file, $infile);
    @chmod($infile, 0666);
    if (!$ok) {
        return new GsError('Failed to copy file to "' . $infile . '".');
    }
    include_once GS_DIR . 'inc/phone-capability.php';
    $phone_types = glob(GS_DIR . 'htdocs/prov/*/capability.php');
    if (!is_array($phone_types)) {
        $phone_types = array();
    }
    for ($i = 0; $i < count($phone_types); ++$i) {
        $phone_types[$i] = baseName(dirName($phone_types[$i]));
    }
    gs_log(GS_LOG_DEBUG, 'Ringtone conversion: Found phone types: ' . implode(', ', $phone_types));
    $errors = array();
    $new_ringer_basename = $user . '-' . subStr($src, 0, 3) . '-' . $rand;
    foreach ($phone_types as $phone_type) {
        include_once GS_DIR . 'htdocs/prov/' . $phone_type . '/capability.php';
        $class = 'PhoneCapability_' . $phone_type;
        if (!class_exists($class)) {
            gs_log(GS_LOG_WARNING, $phone_type . ': Class broken.');
            $errors[] = $phone_type . ': Class broken.';
            continue;
        }
        $PhoneCapa = new $class();
        $outfile = $PhoneCapa->conv_ringtone($infile, $outbase);
        if (isGsError($outfile)) {
            gs_log(GS_LOG_WARNING, 'Ringtone conversion: ' . $phone_type . ': ' . $outfile->getMsg());
            $errors[] = $phone_type . ': ' . $outfile->getMsg();
        } elseif ($outfile === null) {
            gs_log(GS_LOG_DEBUG, 'Ringtone conversion: ' . $phone_type . ': Not implemented.');
            continue;
        } elseif (!$outfile) {
            gs_log(GS_LOG_WARNING, 'Ringtone conversion: ' . $phone_type . ': Failed to convert file.');
            $errors[] = $phone_type . ': ' . 'Failed to convert file.';
            continue;
        }
        if (!file_exists($outfile)) {
            gs_log(GS_LOG_WARNING, 'Ringtone conversion: ' . $phone_type . ': Failed to convert file.');
            $errors[] = $phone_type . ': ' . 'Failed to convert file.';
            continue;
        }
        gs_log(GS_LOG_DEBUG, 'Ringtone conversion: ' . $phone_type . ': Converted.');
        @chmod($outfile, 0666);
        $pinfo = pathInfo($outfile);
        $ext = strToLower(@$pinfo['extension']);
        $newbase = $new_ringer_basename . '-' . $phone_type . '.' . $ext;
        if ($phone_type === 'siemens' && !gs_get_conf('GS_SIEMENS_PROV_PREFER_HTTP')) {
            # if this is a Siemens phone, push the file on the FTP server
            @copy($infile, '/tmp/' . $newbase);
            //FIXME - why?
            $ok = $PhoneCapa->_upload_ringtone('/tmp/' . $newbase);
            if (!$ok) {
                gs_log(GS_LOG_WARNING, 'Failed to upload ringtone to FTP server.');
            }
            if (is_file('/tmp/' . $newbase)) {
                @unlink('/tmp/' . $newbase);
            }
        } else {
            if ($we_are_the_webserver) {
                # local
                //rename( $outfile, GS_DIR .'htdocs/prov/ringtones/'. $newbase );
                @exec('sudo mv ' . qsa($outfile) . ' ' . qsa(GS_DIR . 'htdocs/prov/ringtones/' . $newbase), $out, $err);
            } else {
                # remotely
                @exec('sudo scp -o StrictHostKeyChecking=no -o BatchMode=yes ' . qsa($outfile) . ' ' . qsa('root@' . GS_PROV_HOST . ':/opt/gemeinschaft/htdocs/prov/ringtones/' . $newbase) . ' >>/dev/null 2>>/dev/null', $out, $err);
                //@exec( 'sudo rm -f '. qsa($outfile) .' >>/dev/null 2>&1' );
                @unlink($outfile);
            }
            if ($err != 0) {
                gs_log(GS_LOG_WARNING, 'Failed to mv ringtone.');
            }
        }
    }
    if (is_file($infile)) {
        @unlink($infile);
    }
    @exec('rm -rf ' . $tmpbase . '-* 1>>/dev/null 2>>/dev/null &');
    if (count($errors) > 0) {
        return new GsError("Failed to convert ringtone for some or all phone types: " . implode(", ", $errors));
    }
    $ok = $db->execute('UPDATE `ringtones` SET `file`=\'' . $db->escape($new_ringer_basename) . '\' WHERE `user_id`=' . $user_id . ' AND `src`=\'' . $src . '\'');
    if (!$ok) {
        return new GsError('DB error.');
    }
    return true;
    // OLD STUFF:
    /*
    # remove old ringer
    #
    $files = @glob( GS_DIR .'htdocs/prov/ringtones/'. $user .'/'. $src .'-*' );
    if (is_array($files)) {
    	foreach ($files as $f) {
    		unlink();
    	}
    }
    die();
    
    
    shell_exec( 'rm -f /opt/ast/htdocs/prov/ringtones/'. $ext .'-*' );
    
    # get SIP name
    #
    $ext = $db->executeGetOne( 'SELECT `name` FROM `ast_sipfriends` WHERE `_user_id`='. $user_id );
    if (! $ext)
    	return new GsError( 'DB error.' );
    
    
    if ($file) {
    	
    	$rand = rand(10000,99999).time();
    	
    	shell_exec( 'mpg123 -m -r 8000 -w - -n 500 -q \''. $file .'\' > \'/opt/gemeinschaft/htdocs/prov/ringtones/'. $rand .'.wav\'' );
    	shell_exec( 'sox \'/opt/gemeinschaft/htdocs/prov/ringtones/'. $rand .'.wav\' -r 8000 -c 1 -w \'/opt/gemeinschaft/htdocs/prov/ringtones/'. $ext .'-'. time() .'.wav\'' );
    	shell_exec( 'rm \'/opt/gemeinschaft/htdocs/prov/ringtones/'. $rand .'.wav\'' );
    	
    } else {
    	//shell_exec( 'rm -f /opt/gemeinschaft/htdocs/prov/ringtones/'. $ext .'-*' );
    }
    
    return true;
    */
}
コード例 #12
0
<?php

require_once dirName(__FILE__) . '/../../../../../../wp-load.php';
?>
<script type="text/javascript">

// executes this when the DOM is ready
jQuery(function(){ 
	// handles the click event of the submit button
	jQuery('#submit').click(function(){
		// defines the options and their default values
		// again, this is not the most elegant way to do this
		// but well, this gets the job done nonetheless

		var shortcode = '[wpsm_post_images_slider]';
		
        window.send_to_editor(shortcode);
		
		// closes Thickbox
		tb_remove();
	});
}); 
</script>
<form action="/" method="get" id="form" name="form" accept-charset="utf-8">
	
    <p>
        <?php 
_e('This shortcode makes slider from all images that attached to post', 'rehub_framework');
?>
    </p>    
	 <p>
コード例 #13
0
 /**
  * @return Nano_Migrate_Step
  * @param string $path
  */
 protected function createStep($path)
 {
     $result = new Nano_Migrate_Step(dirName(__FILE__) . '/_files/db-migrate-steps/' . $path);
     $result->load();
     return $result;
 }
コード例 #14
0
ファイル: pngbehavior.htc.php プロジェクト: rkania/GS3
<?php

header('Content-Type: text/x-component');
//header( 'Content-Type: text/plain' );
//header( 'Pragma: cache' );
header('Cache-Control: public, max-age=120, must-revalidate');
//header( 'Last-Modified: '. gmDate('D, d M Y 00:00:00') .' GMT');
//header( 'Expires: '. gmDate('D, d M Y 23:59:59') .' GMT');
header('Expires: ' . gmDate('D, d M Y H:i:s', time() + 120) . ' GMT');
//header( 'ETag: '. gmDate('Ymd') );
define('GS_VALID', true);
/// this is a parent file
require_once dirName(__FILE__) . '/../../../inc/conf.php';
# set paths
#
$GS_URL_PATH = dirName(dirName(@$_SERVER['SCRIPT_NAME']));
if (subStr($GS_URL_PATH, -1, 1) != '/') {
    $GS_URL_PATH .= '/';
}
header('ETag: ' . gmDate('Ymd') . '-' . md5($GS_URL_PATH));
function _not_modified()
{
    header('HTTP/1.0 304 Not Modified', true, 304);
    header('Status: 304 Not Modified', true, 304);
    exit;
}
if (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER) && $_SERVER['HTTP_IF_NONE_MATCH'] === gmDate('Ymd') . '-' . md5($GS_URL_PATH)) {
    _not_modified();
}
/*
$tmp = gmDate('D, d M Y');
コード例 #15
0
ファイル: Application.php プロジェクト: visor/nano
 public function __construct()
 {
     parent::__construct();
     $this->readOnly('configFormat')->readOnly('nanoRootDir', dirName(__DIR__))->readOnly('loader', new Loader())->readOnly('modules', new Application\Modules())->readOnly('plugins', new \SplObjectStorage())->readOnly('helper', new HelperBroker())->readOnly('dispatcher', new Application\Dispatcher())->readOnly('eventManager', new Event\Manager())->readOnly('rootDir')->readOnly('publicDir')->readOnly('modulesDir')->readOnly('sharedModulesDir')->ensure('configFormat', 'Nano\\Application\\Config\\Format')->ensure('config', 'Nano\\Application\\Config')->ensure('modules', 'Nano\\Application\\Modules')->ensure('dispatcher', 'Nano\\Application\\Dispatcher')->ensure('helper', 'Nano\\HelperBroker')->ensure('eventManager', 'Nano\\Event\\Manager')->ensure('plugins', 'SplObjectStorage');
 }
コード例 #16
0
ファイル: settings.php プロジェクト: amooma/GS3
function _settings_out()
{
    global $settings, $fw_vers_nrml, $prov_url_snom;
    if (_snomAppCmp($fw_vers_nrml, '7.1.8') < 0) {
        header('Content-Type: text/plain; charset=utf-8');
        # the Content-Type header is ignored by the Snom
        foreach ($settings as $name => $a1) {
            if (subStr($name, 0, 1) === '_') {
                continue;
            }
            if (!array_key_exists('_is_array', $a1)) {
                echo $name, $a1['w'] ? '$' : '&', ': ', $a1['v'], "\n";
            } else {
                if ($name !== 'fkey') {
                    foreach ($a1 as $idx => $a2) {
                        if ($idx === '_is_array') {
                            continue;
                        }
                        echo $name, $idx, $a2['w'] ? '$' : '&', ': ', $a2['v'], "\n";
                    }
                } else {
                    foreach ($a1 as $idx => $a2) {
                        if ($idx === '_is_array') {
                            continue;
                        }
                        echo $name, $idx, $a2['w'] ? '$' : '&', ': ', $a2['v'], "\n";
                        if (is_array($a2['a']) && array_key_exists('context', $a2['a'])) {
                            echo $name, '_context', $idx, $a2['w'] ? '$' : '&', ': ', $a2['a']['context'], "\n";
                        }
                    }
                }
            }
            /*
            	! means writeable by the user, but will not overwrite existing
            	$ means writeable by the user, but will overwrite existing (available since version 4.2)
            	& (or no flag) means read only, but will overwrite existing
            */
        }
        unset($settings);
    } else {
        header('Content-Type: application/xml; charset=utf-8');
        echo '<', '?xml version="1.0" encoding="utf-8"?', '>', "\n";
        echo '<settings>', "\n\n";
        $xml_cats = array();
        foreach ($settings as $name => $a1) {
            if (!array_key_exists('_is_array', $a1)) {
                $attrstr = '';
                if (is_array($a1['a'])) {
                    foreach ($a1['a'] as $attr => $attrval) {
                        $attrstr .= ' ' . $attr . '="' . _snomCnfXmlEsc($attrval) . '"';
                    }
                }
                $line = '<' . $name . $attrstr . ' perm="' . ($a1['w'] ? 'RW' : 'R') . '">' . _snomCnfXmlEsc($a1['v']) . '</' . $name . '>';
                _add_to_cat($xml_cats, $name, $line);
            } else {
                if ($name === '_gui_lang' || $name === '_web_lang') {
                    foreach ($a1 as $idx => $a2) {
                        if ($idx === '_is_array') {
                            continue;
                        }
                        $attrstr = '';
                        if (is_array($a2['a'])) {
                            foreach ($a2['a'] as $attr => $attrval) {
                                $attrstr .= ' ' . $attr . '="' . _snomCnfXmlEsc($attrval) . '"';
                            }
                        }
                        $line = '<language url="' . $prov_url_snom . 'sw/' . _snomCnfXmlEsc($a2['v']) . '" name="' . _snomCnfXmlEsc($idx) . '"' . $attrstr . ' />';
                        $langfile = GS_DIR . 'htdocs/prov/snom/sw/' . $a2['v'];
                        $langfile_lock = $langfile . '.lock';
                        $langfiles_dir = dirName($langfile) . '/';
                        $langfile_url = 'http://provisioning.snom.com/config/snom' . $a2['v'];
                        if (file_exists($langfile) && is_readable($langfile) && file_exists($langfile . '.done')) {
                            //gs_log(GS_LOG_DEBUG, '---1');
                            _add_to_cat($xml_cats, $name, $line);
                        } else {
                            /*
                            gs_log(GS_LOG_DEBUG, '---2');
                            if (! file_exists($langfiles_dir)) {
                            	gs_log(GS_LOG_DEBUG, '---3');
                            	@exec( 'sudo mkdir -p '. qsa($langfiles_dir) .' 1>>/dev/null 2>>/dev/null' );
                            }
                            if (file_exists($langfiles_dir)) {
                            	gs_log(GS_LOG_DEBUG, '---4');
                            	$err=0; $out=array();
                            	@exec( 'sudo touch '. qsa($langfile_lock) .' && sudo chmod 666 '. qsa($langfile_lock) .' 1>>/dev/null 2>>/dev/null', $out, $err );
                            	if ($err==0) {
                            		gs_log(GS_LOG_DEBUG, '---5');
                            		$lockfh = @fOpen( $langfile_lock, 'wb' );
                            		if ($lockfh) {
                            			gs_log(GS_LOG_DEBUG, '---6');
                            			$would_block = false;
                            			if (@flock($lockfh, LOCK_SH, $would_block)) {
                            				gs_log(GS_LOG_DEBUG, '---7');
                            				if (! $would_block) {
                            					gs_log(GS_LOG_DEBUG, '---8');
                            					gs_log( GS_LOG_NOTICE, 'Trying to wget '. qsa($langfile_url) );
                            					@exec( 'sudo cd '. qsa($langfiles_dir) .' && sudo wget -q -a /dev/null -t 1 -T 300 -nc -c '. qsa($langfile_url) .' && sudo touch '. qsa($langfile.'.done') .' 1>>/dev/null 2>>/dev/null &' );
                            				}
                            				@flock($lockfh, LOCK_UN);
                            			}
                            			@fClose($lockfh);
                            		}
                            	}
                            }
                            */
                            gs_log(GS_LOG_NOTICE, 'Please  cd ' . qsa($langfiles_dir) . ' && wget ' . qsa($langfile_url) . ' && touch ' . qsa(baseName($langfile) . '.done'));
                        }
                    }
                } else {
                    foreach ($a1 as $idx => $a2) {
                        if ($idx === '_is_array') {
                            continue;
                        }
                        $attrstr = '';
                        if (is_array($a2['a'])) {
                            foreach ($a2['a'] as $attr => $attrval) {
                                $attrstr .= ' ' . $attr . '="' . _snomCnfXmlEsc($attrval) . '"';
                            }
                        }
                        $line = '<' . $name . $attrstr . ' idx="' . $idx . '" perm="' . ($a2['w'] ? 'RW' : 'R') . '">' . _snomCnfXmlEsc($a2['v']) . '</' . $name . '>';
                        _add_to_cat($xml_cats, $name, $line);
                    }
                }
            }
        }
        unset($settings);
        foreach ($xml_cats as $cat => $lines) {
            echo "\t", '<', $cat, '>', "\n";
            foreach ($lines as $line) {
                echo $line, "\n";
            }
            echo "\t", '</', $cat, '>', "\n\n";
        }
        unset($xml_cats);
        echo '</settings>', "\n";
    }
}
コード例 #17
0
ファイル: TestCase.php プロジェクト: studio-v/nano
 protected function getTestFile($path)
 {
     $class = new ReflectionClass($this);
     return dirName($class->getFileName()) . '/_files' . $path;
 }
コード例 #18
0
ファイル: body.tpl.php プロジェクト: solyfast/littlebit-fw
	<body>
		<div class = "main">
	<?php 
$dir = dirName(__FILE__) . "/pages/" . $page . "/front.tpl.php";
if (file_exists($dir)) {
    require_once $dir;
}
?>
	</div>
</body>
コード例 #19
0
ファイル: index.php プロジェクト: solyfast/littlebit-fw
<?php

session_start();
#include helpers
#request
$dir = dirName(__FILE__) . "/helpers/request.helper.php";
require_once $dir;
#include classes
#config
$dir = dirName(__FILE__) . "/core/config.core.php";
require_once $dir;
#database
$dir = dirName(__FILE__) . "/core/database.core.php";
require_once $dir;
#router
$dir = dirName(__FILE__) . "/core/router.core.php";
require_once $dir;
#template
$dir = dirName(__FILE__) . "/core/template.core.php";
require_once $dir;
#include models
//
$router = new core\router();
コード例 #20
0
ファイル: Nano.php プロジェクト: studio-v/nano
<?php

define('DS', DIRECTORY_SEPARATOR);
define('PS', PATH_SEPARATOR);
define('LIB', __DIR__);
define('ROOT', dirName(LIB));
define('PACK', ROOT . DS . 'packages');
define('APP', ROOT . DS . 'application');
define('SETTINGS', APP . DS . 'settings');
define('CONTROLLERS', APP . DS . 'controllers');
define('MODELS', APP . DS . 'models');
define('LAYOUTS', APP . DS . 'layouts');
define('VIEWS', APP . DS . 'views');
define('HELPERS', APP . DS . 'helpers');
define('PLUGINS', APP . DS . 'plugins');
define('APP_LIB', APP . DS . 'library');
define('MESSAGES', APP . DS . 'messages');
define('PUBLIC', ROOT . DS . 'public');
define('TESTS', ROOT . DS . 'tests');
define('ENV', Nano::config('env'));
define('WEB_ROOT', Nano::config('web')->root);
define('WEB_URL', Nano::config('web')->url);
require LIB . DS . 'Nano' . DS . 'Loader.php';
final class Nano
{
    /**
     * @var Nano
     */
    private static $instance = null;
    /**
     * @var Nano_Dispatcher
コード例 #21
0
        } else {
            return false;
        }
    }
    @header('Location: ' . $location);
    return true;
}
define('GS_WEB_REWRITE', array_key_exists('REDIRECT_URL', $_SERVER) || array_key_exists('_GS_HAVE_REWRITE', $_SERVER) || array_key_exists('REDIRECT__GS_HAVE_REWRITE', $_SERVER));
$dispatcher_errors_html = array();
$GS_INSTALLATION_TYPE = gs_get_conf('GS_INSTALLATION_TYPE');
if (gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
    require_once GS_DIR . 'htdocs/gui/setup/inc/aux-fns.php';
    if (gs_setup_autoshow()) {
        $url = http_get_request_url(false);
        if ($url != false) {
            $url .= dirName($_SERVER['SCRIPT_NAME']) . '/setup/';
            if (http_redirect_temporarily($url, false, true)) {
                echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', "\n";
                echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">', "\n";
                echo '<head>', "\n";
                echo '<title>Gemeinschaft</title>', "\n";
                echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />', "\n";
                echo '</head>', "\n";
                echo '<body>', "\n";
                echo '<br /><p align="center"><a href="setup/">Setup</a></p>', "\n";
                echo '</body>', "\n";
                echo '</html>';
                exit;
            }
        }
    }
コード例 #22
0
 /**
  * 	getfilespec
  *
  * @param  $fid
  * 
  *
  * @return
  * 
  */
 function getfilespec($fid)
 {
     $ds = DIRECTORY_SEPARATOR;
     $pwd = EasyContactFormsSecurityManager::getServerPwd();
     $spec = (object) array();
     $spec->htmlfile = 'form-' . $fid . '.html';
     $spec->subpath = array();
     $spec->subpath[] = 'forms';
     $spec->subpath[] = 'tmp';
     $spec->subpath[] = md5($pwd);
     $spec->dir = dirName(__FILE__) . $ds . implode($ds, $spec->subpath);
     $spec->filepath = $spec->dir . $ds . $spec->htmlfile;
     $spec->webfolder = EASYCONTACTFORMS__engineWebAppDirectory . '/' . implode('/', $spec->subpath);
     $spec->fileurl = $spec->webfolder . '/' . $spec->htmlfile;
     return $spec;
 }
コード例 #23
0
ファイル: _bootstrap.php プロジェクト: studio-v/nano
<?php

error_reporting(E_ALL);
ini_set('error_log', dirName(__FILE__) . '/reports/error.log');
define('TESTING', true);
require dirName(__FILE__) . '/../library/Nano.php';
Nano::instance();
Nano::config('selenium');
Nano_Db::setDefault('test');
コード例 #24
0
        }
    }
    if ($msgid !== null) {
        _po_to_php_store_msg($trans, $msgid, $msgstr);
    }
    return $trans;
}
$dir = dirName(__FILE__) . '/';
$langdirs = glob($dir . '*_*/');
if (is_array($langdirs)) {
    foreach ($langdirs as $langdir) {
        $pofiles = glob($langdir . 'LC_MESSAGES/*.po');
        if (is_array($pofiles)) {
            foreach ($pofiles as $pofile) {
                $domain = baseName($pofile, '.po');
                $lang = baseName(dirName(dirName($pofile)));
                /*
                # build .mo file for gettext
                #
                echo "Building $lang $domain.mo ...\n";
                $mofile = preg_replace('/\.po$/', '.mo', $pofile);
                passThru( 'msgfmt -o '. qsa($mofile) .' '. qsa($pofile), $err );
                if ($err !== 0) {
                	echo "  Failed.";
                	if ($err === 127) echo " (msgfmt not found. gettext not installed?)";
                	echo "\n";
                }
                */
                # build .php file for php
                #
                echo "Building {$lang} {$domain}.php ...\n";
コード例 #25
0
function easycontactforms_uninstall()
{
    global $wpdb;
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_applicationsettings;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_contacttypes;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_customformentryfiles;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_customformentrystatistics;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_customformfields;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_customformfieldtypes;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_customforms;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_customforms_mailinglists;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_customformsentries;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_files;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_options;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_roles;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_users;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_acl;";
    $sqls[] = "DROP TABLE IF EXISTS #wp__easycontactforms_sessions;";
    require_once dirName(__FILE__) . DIRECTORY_SEPARATOR . 'easy-contact-forms-database.php';
    foreach ($sqls as $sql) {
        $sql = EasyContactFormsDB::wptn($sql);
        $wpdb->query($sql);
    }
}
コード例 #26
0
ファイル: prov_firmware.php プロジェクト: rkania/GS3
include_once GS_DIR . 'inc/phone-capability.php';
echo '<h2>';
if (@$MODULES[$SECTION]['icon']) {
    echo '<img alt=" " src="', GS_URL_PATH, str_replace('%s', '32', $MODULES[$SECTION]['icon']), '" /> ';
}
if (count($MODULES[$SECTION]['sub']) > 1) {
    echo $MODULES[$SECTION]['title'], ' - ';
}
echo $MODULES[$SECTION]['sub'][$MODULE]['title'];
echo '</h2>', "\n";
$phone_types = glob(GS_DIR . 'htdocs/prov/*/capability.php');
if (!is_array($phone_types)) {
    $phone_types = array();
}
for ($i = 0; $i < count($phone_types); ++$i) {
    $phone_types[$i] = baseName(dirName($phone_types[$i]));
}
foreach ($phone_types as $phone_type) {
    include_once GS_DIR . 'htdocs/prov/' . $phone_type . '/capability.php';
    $class = 'PhoneCapability_' . $phone_type;
    if (!class_exists($class)) {
        gs_log(GS_LOG_WARNING, $phone_type . ': Class broken.');
        //$errors[] = $phone_type .': Class broken.';
        continue;
    }
    $PhoneCapa = new $class();
    $firmware_files = $PhoneCapa->get_firmware_files();
    echo '<table cellspacing="1" style="width:95%;">', "\n";
    echo '<thead>', "\n";
    echo '<tr><th>', strToUpper($phone_type), '</th></tr>', "\n";
    echo '</thead>', "\n";
コード例 #27
0
ファイル: conf.php プロジェクト: hehol/GemeinschaftPBX
# STDIN, STDOUT, STDERR
#
# http://bugs.php.net/bug.php?id=43283
# http://bugs.centos.org/view.php?id=1633
if (!defined('STDIN')) {
    define('STDIN', @fOpen('php://stdin', 'rb'));
}
if (!defined('STDOUT')) {
    define('STDOUT', @fOpen('php://stdout', 'wb'));
}
if (!defined('STDERR')) {
    define('STDERR', @fOpen('php://stderr', 'wb'));
}
# our root directory
#
define('GS_DIR', realPath(dirName(__FILE__) . '/../') . '/');
# DO NOT CHANGE!
# log levels
#
define('GS_LOG_FATAL', 1 << 1);
# SYSTEM CONSTANTS. DO NOT CHANGE!
define('GS_LOG_WARNING', 1 << 2);
#  "
define('GS_LOG_NOTICE', 1 << 3);
#  "
define('GS_LOG_DEBUG', 1 << 4);
#  "
function gs_get_conf($key, $default = null)
{
    return @defined($key) ? constant($key) : $default;
}
コード例 #28
0
ファイル: setup.php プロジェクト: studio-v/nano
function fromTo($from, $to)
{
    echo "\t", sprintf('%-20s', $from), ' => ', $to, PHP_EOL;
}
echo 'Setting up', PHP_EOL;
$root = realPath(__DIR__ . '/../application/settings') . DIRECTORY_SEPARATOR;
$env = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'dev';
fromTo('env.php', $root . 'env.php');
file_put_contents($root . 'env.php', '<?php $config = \'' . $env . '\';');
require dirName(__DIR__) . '/library/Nano.php';
$files = array('db.php' => 'db.php', 'log.php' => 'log.php', 'selenium.php' => 'selenium.php', 'web.php' => 'web.php', 'assets.php' => 'assets.php', 'plugins.php' => 'plugins.php');
$source = __DIR__ . '/setup/' . $env;
if (file_exists($source)) {
    foreach ($files as $from => $to) {
        $sourceFile = $source . DS . $from;
        $destinationDir = realPath(dirName($root . $to));
        $destinationFile = $destinationDir . DS . baseName($to);
        if (file_exists($sourceFile)) {
            fromTo($from, $destinationFile);
            copy($sourceFile, $destinationFile);
        }
    }
}
echo 'Done', PHP_EOL;
if (file_exists($source . '.php')) {
    include $source . '.php';
    if (function_exists('setupEnv')) {
        setupEnv();
    }
}
Nano::reloadConfig();
コード例 #29
0
ファイル: pb.php プロジェクト: hehol/GemeinschaftPBX
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
\*******************************************************************/
# caution: earlier versions of Aastra firmware do not like
# indented XML
define('GS_VALID', true);
/// this is a parent file
require_once dirName(__FILE__) . '/../../../inc/conf.php';
include_once GS_DIR . 'inc/db_connect.php';
include_once GS_DIR . 'inc/aastra-fns.php';
include_once GS_DIR . 'inc/gettext.php';
include_once GS_DIR . 'inc/group-fns.php';
include_once GS_DIR . 'inc/string.php';
$xml = '';
function _err($msg = '')
{
    aastra_textscreen('Error', $msg != '' ? $msg : 'Unknown error');
    exit(1);
}
function _get_userid()
{
    global $_SERVER, $db;
    $remote_addr = @$_SERVER['REMOTE_ADDR'];
コード例 #30
0
 /**
  * Get the name of the package where the class $className was defined
  * @return  string  name of the package
  */   
 static function getPackageNameForClass($className) {
   $rc = new ReflectionClass($className);
   return baseName(dirName($rc->getFileName()));
 }