Exemple #1
0
 /**
  * Get the specified configuration value.
  *
  * @param  string  $key      Name of the key
  * @param  mixed   $default  Default value
  * @param  bool    $dbLookup If false, do not access the database table
  * @return mixed
  */
 public static function get($key, $default = null, $dbLookup = true)
 {
     if (installed() and $dbLookup) {
         $dbChecked = Cache::has(self::CACHE_IN_DB_PREFIX . $key);
         if ($dbChecked) {
             $inDb = Cache::get(self::CACHE_IN_DB_PREFIX . $key);
             if ($inDb) {
                 return Cache::get(self::CACHE_VALUES_PREFIX . $key);
             }
         } else {
             $result = DB::table('config')->whereName($key)->first();
             if (is_null($result)) {
                 Cache::put(self::CACHE_IN_DB_PREFIX . $key, false, self::CACHE_TIME);
             } else {
                 Cache::put(self::CACHE_IN_DB_PREFIX . $key, true, self::CACHE_TIME);
                 Cache::put(self::CACHE_VALUES_PREFIX . $key, $result->value, self::CACHE_TIME);
                 return $result->value;
             }
         }
     }
     if ((strpos($key, '.') !== false or strpos($key, '::') !== false) and LaravelConfig::has($key)) {
         return LaravelConfig::get($key, $default);
     }
     return $default;
 }
Exemple #2
0
    	<strong>Music Downloads</strong><br/>(Rules for Users Downloading Music)<br/><select name='downloads'><option value='0' >Not Allowed</option><option value='1' >Allowed for All</option><option value='2' >Allowed with Permission</option></select><br/><br/>
    	<strong>Amazon API Key</strong><br/>(needed for downloading Album Art) <a href='http://www.amazon.com/webservices/' target='_new'>Obtain Key</a><br/><input type='text' size='30' name='amazonid' /><br/><br/>
    	 <strong>Path to MP3 Player</strong><br/>(ex. /usr/bin/mpg123)<br/><input type='text' size='30' name='mp3bin'  /><br/><br/>
    	 <strong>Path to Lame Encoder</strong><br/>(ex. /usr/bin/lame)<br/><input type='text' size='30' name='lamebin'  /><br/><br/>
    	<strong>Path to PHP-CLI Binary</strong><br/>(ex. /usr/bin/php)<br/><input type='text' size='30' name='phpbin'  /><br/><br/>
			<input type='submit' value='save settings and continue &raquo;' class='btn' />
  
			</p>
				
				</form>
			<?php 
        }
        break;
    case 4:
        mp3act_connect();
        if (!installed()) {
            $query = "UPDATE mp3act_settings SET invite_mode={$_POST['invite']},sample_mode={$_POST['sample_mode']},downloads={$_POST['downloads']},amazonid=\"{$_POST['amazonid']}\",mp3bin=\"{$_POST['mp3bin']}\",lamebin=\"{$_POST['lamebin']}\",phpbin=\"{$_POST['phpbin']}\" WHERE id=1";
            mysql_query($query);
            echo "<strong>Settings Saved....</strong><br/><br/>";
            echo "<strong>Installation Successful!</strong><br/><br/>";
            if (!ini_get('allow_url_fopen')) {
                echo "<strong class='error'>WARNING: </strong>Need to Set allow_url_fopen to 'On' in your php.ini file.<br/><br/>";
            }
            if (!is_writable($GLOBALS['abs_path'] . "/art/")) {
                echo "<strong class='error'>WARNING: </strong>The /art/ directory is currently not writable. Please change the permissions on this directory if you wish to use Album Art.<br/><br/>";
            }
            echo "<a href=\"{$GLOBALS['http_url']}{$GLOBALS['uri_path']}/\">Login to your new mp3act server</a><br/>";
            $random_password = substr(md5(uniqid(microtime())), 0, 6);
            $query = "INSERT INTO `mp3act_users` VALUES (NULL, 'admin', 'Admin', 'User', PASSWORD(\"{$random_password}\"), 10, NOW(), 1, '', 'streaming', 0, 's', '21232f297a57a5a743894a0e4a801fc3', '', '0000-00-00 00:00:00', 1,'','','',0)";
            mysql_query($query);
            echo "<br/><strong>Username:</strong> Admin<br/><strong>Password:</strong> {$random_password} (Please change this password as soon as you login.)<br/><br/>";
Exemple #3
0
<?php

include_once dirname(__FILE__) . "/frame.class.inc";
include_once dirname(__FILE__) . "/class.unix.inc";
if (isset($_GET["status"])) {
    status();
    exit;
}
if (isset($_GET["restart"])) {
    restart();
    exit;
}
if (isset($_GET["installed"])) {
    installed();
    exit;
}
if (isset($_GET["uncompress"])) {
    uncompress();
    exit;
}
while (list($num, $line) = each($_GET)) {
    $f[] = "{$num}={$line}";
}
writelogs_framework("unable to understand query !!!!!!!!!!!..." . @implode(",", $f), "main()", __FILE__, __LINE__);
die;
function restart()
{
    $unix = new unix();
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $cmd = trim("{$php5} /usr/share/artica-postfix/exec.initslapd.php --snmpd 2>&1");
Exemple #4
0
        info(PHP_EOL . "No installed Project.");
    }
})->desc("Update current Project Release");
/**
 * Инсталяция проекта.
 * Сначала нужно инсталировать проект командой app:install.
 * В дальнейшем только обновлять командой app:deploy или app:update.
 */
task("app:install", ["deploy:setup", "deploy:download", "deploy:current", "deploy:cleanup"])->desc("Install Project '{$name}'");
/**
 * Удаление проекта.
 * Каталог с данными пользователя (install/path/data) сохраняется (если опция --with-data != yes).
 * Внимание, файл .htaccess из веб-папки будет удален.
 */
task("app:uninstall", function ($input) {
    if (installed()) {
        $installPath = config()->getPath();
        $documentRootPath = get("documentRootPath", null);
        run("rm -f {$documentRootPath}");
        makeDir($documentRootPath);
        info(PHP_EOL);
        info("Restored directory {$documentRootPath}");
        if ($input->getOption("with-data") == "yes") {
            run("rm -rf {$installPath}");
            info("Deleted directory {$installPath}");
        } else {
            run("rm -f {$installPath}/current");
            run("rm -rf {$installPath}/releases");
            info("Deleted symlink {$installPath}/current");
            info("Deleted directory {$installPath}/releases");
        }
Exemple #5
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     /*
     |--------------------------------------------------------------------------
     | Visitor Statistics
     |--------------------------------------------------------------------------
     |
     | Updates the global visitor statistics.
     |
     */
     if (!App::runningInConsole() and installed()) {
         $today = time();
         $isNewVisitor = Session::get('ipLogged') == null;
         if (Session::get('ipLogged') and Session::get('ipLogged') != date('d', $today)) {
             $isNewVisitor = true;
             // Change of day makes every user a new visitor
         }
         if ($isNewVisitor) {
             $ip = getenv('REMOTE_ADDR');
             // Get the client agent's IP
             $rowsAffected = DB::table('visits')->whereIp($ip)->whereVisitedAt(date('Y-m-d', $today))->increment('user_agents');
             if (!$rowsAffected) {
                 DB::table('visits')->insert(array('ip' => $ip, 'user_agents' => 1, 'visited_at' => date('Y-m-d', $today)));
             }
             Session::put('ipLogged', date('d', $today));
             // Keep in our session-mind the day we logged this IP
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Update User's Last Active Time
     |--------------------------------------------------------------------------
     |
     | To decide if a user is only or not we use an attribute in the 
     | users table/model called last_active. We update it to 
     | the current time in a specific interval.
     |
     */
     if (installed() and user()) {
         $lastActive = Session::get('lastActiveUpdate', 0);
         if (time() - $lastActive > 60) {
             $user = user();
             $user->last_active = new Carbon();
             $user->save();
             Session::set('lastActiveUpdate', time());
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Language Settings
     |--------------------------------------------------------------------------
     |
     | Set the language for the user (also if not logged in)
     |
     */
     if (!Session::has('app.locale')) {
         if (user()) {
             Session::set('app.locale', user()->language->code);
             App::setLocale(Session::get('app.locale'));
         } else {
             if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                 $clientLanguage = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
                 $languages = File::directories(base_path() . '/resources/lang');
                 array_walk($languages, function (&$value, $key) {
                     $value = basename($value);
                 });
                 if (in_array($clientLanguage, $languages)) {
                     Session::set('app.locale', $clientLanguage);
                 } else {
                     Session::set('app.locale', Lang::getLocale());
                 }
             } else {
                 Session::set('app.locale', Lang::getLocale());
             }
         }
     } else {
         App::setLocale(Session::get('app.locale'));
     }
     Carbon::setToStringFormat(trans('app.date_format'));
     return $next($request);
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     /*
     |--------------------------------------------------------------------------
     | Custom Validation Rules
     |--------------------------------------------------------------------------
     |
     | This is the right place for custom validators.
     |
     */
     Validator::extend('alpha_spaces', function ($attribute, $value) {
         return preg_match('/^[\\pL\\s]+$/u', $value);
     });
     /*
     |--------------------------------------------------------------------------
     | Blade Extensions
     |--------------------------------------------------------------------------
     |
     | This is the right place to setup blade extensions
     | that do not belong to modules.
     |
     */
     /*
      * Helper. Renders a widget.
      */
     Blade::directive('widget', function ($expression) {
         return '<?php echo HTML::widget' . $expression . '; ?>';
     });
     /*
     |--------------------------------------------------------------------------
     | Visitor Statistics
     |--------------------------------------------------------------------------
     |
     | Updates the global visitor statistics.
     |
     */
     if (!App::runningInConsole() and installed()) {
         $today = time();
         $isNewVisitor = Session::get('ipLogged') == null;
         if (Session::get('ipLogged') and Session::get('ipLogged') != date('d', $today)) {
             $isNewVisitor = true;
             // Change of day makes every user a new visitor
         }
         if ($isNewVisitor) {
             $ip = getenv('REMOTE_ADDR');
             // Get the client agent's IP
             $rowsAffected = DB::table('visits')->whereIp($ip)->whereVisitedAt(date('Y-m-d', $today))->increment('user_agents');
             if (!$rowsAffected) {
                 DB::table('visits')->insert(array('ip' => $ip, 'user_agents' => 1, 'visited_at' => date('Y-m-d', $today)));
             }
             Session::put('ipLogged', date('d', $today));
             // Keep in our session-mind the day we logged this IP
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Jobs
     |--------------------------------------------------------------------------
     |
     | Register Jobs
     |
     */
     Jobs::addLazy('updateStreams', 'App\\Modules\\Streams\\UpdateStreamsJob');
     Jobs::addLazy('deleteUserActivities', 'Contentify\\DeleteUserActivitiesJob');
     /*
     |--------------------------------------------------------------------------
     | Language Settings
     |--------------------------------------------------------------------------
     |
     | Set the language for the user (also if not logged in)
     |
     */
     if (!Session::has('app.locale')) {
         if (user()) {
             Session::set('app.locale', user()->language->code);
             App::setLocale(Session::get('app.locale'));
         } else {
             if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                 $clientLanguage = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
                 $languages = File::directories(base_path() . '/resources/lang');
                 array_walk($languages, function (&$value, $key) {
                     $value = basename($value);
                 });
                 if (in_array($clientLanguage, $languages)) {
                     Session::set('app.locale', $clientLanguage);
                 } else {
                     Session::set('app.locale', Lang::getLocale());
                 }
             } else {
                 Session::set('app.locale', Lang::getLocale());
             }
         }
     } else {
         App::setLocale(Session::get('app.locale'));
     }
     Carbon::setToStringFormat(trans('app.date_format'));
 }