/** * Change skin. * * @param Request $request */ public function postSkin(Request $request) { $skin = $request->get('value', 'default-skin'); if (Config::where('key', 'skin')->update(['value' => $skin])) { return Response::json(['status' => 1]); } }
/** * Run the database seeds. * * @return void */ public function run() { $options = [['name' => 'title', 'value' => 'shcms', 'title' => '网站标题'], ['name' => 'author', 'value' => 'shellus', 'title' => '作者'], ['name' => 'Copyright', 'value' => 'Copyright', 'title' => '版权文字'], ['name' => 'keywords', 'value' => '黄色网站,无毒的黄色网站,免费的黄色网站,最有情怀的黄色网站', 'title' => '网站关键词'], ['name' => 'description', 'value' => '很明显,这是一个黄色网站无疑。。', 'title' => '网站介绍']]; foreach ($options as $option) { \App\Model\Config::create($option); } }
/** * Get anim name of images. * * @param $anim * @return mixed */ public function getAnimName() { $anim = $this->getAttribute('anim'); $images_anim = Config::getConfigValueByKey('images_anim'); if ($images_anim && is_array($images_anim) && array_key_exists($anim, $images_anim)) { return $images_anim[$anim]; } return null; }
public function postUpdate(ConfigRequest $request) { $configs = $request->all(); foreach ($configs as $key => $value) { Config::where('key', '=', $key)->update(['value' => $value]); } Flash::success('修改成功!'); return Redirect::to('/admin/config/edit'); }
/** * compose images anim variable. */ private function composeImageAnim() { View::composer(['memory.create'], function ($view) { $view->with(['anim' => Config::getConfigValueByKey('images_anim')]); }); View::composer(['memory.show'], function ($view) { $view->with(['images_anim' => Response::json(Config::getConfigValueByKey('images_anim'))->getContent()]); }); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (Config::getConfigValueByKey('is_open')) { return $next($request); } if (!Session::has('user')) { return Redirect::to('/auth'); } return $next($request); }
private function __construct() { //building the connection string $tns = 'mysql:host=' . Config::read('DBHOST') . ';dbname=' . Config::read('DBNAME'); //echo $tns; //GET THE DB USER FROM CONFIG $user = Config::read('DBUSER'); //GET THE DB PASS FROM CONFIG $password = Config::read('DBPASS'); $this->dbConn = new PDO($tns, $user, $password); $this->dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('configs')->delete(); Config::create(['type' => 'color', 'key' => 'panel_color', 'value' => 'rgba(255,255,255,0.3)', 'title' => '展示板颜色', 'description' => '修改展示板的颜色']); Config::create(['type' => 'color', 'key' => 'bar_color', 'value' => 'rgba(255,255,255,0.3)', 'title' => '时间轴颜色', 'description' => '修改时间轴的颜色']); Config::create(['type' => 'color', 'key' => 'icon_border_color', 'value' => 'rgba(255,255,255,0.3)', 'title' => '图标边界颜色', 'description' => '修改图标边界的颜色']); Config::create(['type' => 'color', 'key' => 'title_color', 'value' => 'rgba(255,255,255,0.3)', 'title' => '标题颜色', 'description' => '修改标题颜色']); Config::create(['type' => 'color', 'key' => 'description_color', 'value' => 'rgba(255,255,255,0.3)', 'title' => '正文颜色', 'description' => '修改正文颜色']); Config::create(['type' => 'color', 'key' => 'location_color', 'value' => 'rgba(255,255,255,0.3)', 'title' => '地点颜色', 'description' => '修改地点颜色']); Config::create(['type' => 'color', 'key' => 'date_color', 'value' => 'rgba(255,255,255,0.3)', 'title' => '日期颜色', 'description' => '修改日期颜色']); Config::create(['type' => 'text', 'key' => 'title', 'value' => '记忆画廊', 'title' => '站点标题', 'description' => '修改站点标题']); Config::create(['type' => 'text', 'key' => 'description', 'value' => '保存你的珍藏记忆', 'title' => '站点描述', 'description' => '修改站点描述']); Config::create(['type' => 'pic', 'key' => 'bg_img', 'value' => '/img/background.jpg', 'title' => '背景图', 'description' => '修改背景图片']); Config::create(['type' => 'select', 'key' => 'is_open', 'value' => '0', 'title' => '是否公开', 'description' => '设置是否公开']); Config::create(['type' => 'array', 'key' => 'auth_kind', 'value' => ['admin' => '管理员', 'guest' => '游客']]); Config::create(['type' => 'array', 'key' => 'open_map', 'value' => ['1' => '开放', '0' => '需密钥']]); Config::create(['type' => 'site', 'key' => 'skin', 'value' => 'blue-skin']); Config::create(['type' => 'array', 'key' => 'images_anim', 'value' => ['random' => '随机动画', 'sim-anim-1' => '圆周绽放', 'sim-anim-2' => '旋转长廊', 'sim-anim-3' => '扇面展开', 'sim-anim-4' => '抛砖引玉', 'sim-anim-5' => '陀螺飞旋', 'sim-anim-6' => '经典画布', 'sim-anim-7' => '国画长卷', 'sim-anim-8' => '大鹏展翅', 'sim-anim-9' => '影院巨幕']]); }
function upload2picasa($file) { $remoteConfig = \Config::getSection("REMOTE_IMAGE"); $uploader = \ChipVN_ImageUploader_Manager::make('Picasa'); echo $uploader->login($remoteConfig["google_user_name"], $remoteConfig["google_user_pass"]); // we don't need password here //$uploader->setApi($remoteConfig["google_client_id"]); // register in console.developers.google.com //$uploader->setSecret($remoteConfig["google_secret_key"]); // you can set upload to an albumId by array of albums or an album, system will get a random album to upload //$uploader->setAlbumId(array('51652569125195125', '515124156195725')); //$uploader->setAlbumId('51652569125195125'); //echo("will echo noe"); //print_r($remoteConfig); //echo $uploader->addAlbum('testing 1'); //echo("ok on"); //if (!$uploader->hasValidToken()) { // $uploader->getOAuthToken('http://yourdomain.com/test.php'); //} //print_r($file); //echo $uploader->upload(getcwd() . '/test.jpg'); // this plugin does not support transload image }
/** * Get config value. * * @return mixed */ public static function getConfigValueByKey($key) { $value = Config::where('key', $key)->first()->value; return $value; }
/** * compose skin. */ private function composeSkin() { View::composer(['manage.options'], function ($view) { $view->with(['skin' => Config::getConfigValueByKey('skin')]); }); }
public function basicAuth() { $config = \Config::getSection("OAUTH_CONFIG"); $this->authuser = Client::authenticate(array("otp:serverUrl" => $config["SERVER"], "otp:publicKey" => $config["BROKER_ID"], "otp:privateKey" => $config["BROKER_SECRET"])); $this->auth(null, null); }
/** * Get token kind. * * @return mixed */ public function getKind() { $kind_map = Config::getConfigValueByKey('auth_kind'); return $kind_map[$this->getAttribute('kind')]; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, Request $request) { if ($request->ajax()) { $config = Config::where('id', '=', $id)->live()->firstOrFail(); $config->status = -1; $config->save(); echo "ok"; } }