Пример #1
0
 public function make()
 {
     $options = Config('session.memcache');
     $this->memcache = new Memcache();
     $this->memcache->connect($options['host'], $options['port']);
     session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
 }
Пример #2
0
 /**
  * 根据班级id获取具体班级名称(一个)
  *
  * @return string
  * @author Hunter.<*****@*****.**>
  */
 public function getClassesName()
 {
     $classesId = $this->getClassesId();
     //根据当前用户的班级值获取对应的班级信息(包括年级)
     $classesInfo = Classes::findFirst($classesId);
     return Config('CONFIG_GRADE')[$classesInfo->getGradeId()] . $classesInfo->getName();
 }
Пример #3
0
 public static function refresh()
 {
     $posts = collect(self::wp_get('get_posts')['posts']);
     $posts->each(function ($item) {
         //delete all previous posts
         if (\Config('cache.default') == 'redis') {
             Redis::pipeline(function ($pipe) {
                 foreach (Redis::keys('laravel:a440:wordpress:posts_*') as $key) {
                     $pipe->del($key);
                 }
             });
         }
         Cache::forever('a440:wordpress:posts_' . $item['id'], $item);
     });
     Cache::forever('a440:wordpress:posts', $posts->transform(function ($item) {
         unset($item['content']);
         unset($item['url']);
         unset($item['status']);
         unset($item['title_plain']);
         unset($item['modified']);
         unset($item['categories']);
         unset($item['comments']);
         unset($item['attachments']);
         unset($item['comment_count']);
         unset($item['comment_status']);
         unset($item['thumbnail']);
         unset($item['custom_fields']);
         unset($item['thumbnail_size']);
         unset($item['thumbnail_images']['full']);
         unset($item['thumbnail_images']['thumbnail']);
         unset($item['thumbnail_images']['post-thumbnail']);
         return $item;
     }));
     Cache::forever('a440:wordpress:categories', collect(self::wp_get('get_category_index')['categories']));
 }
Пример #4
0
 /**
  * Change Language from user choose.
  *
  * @return array
  */
 public function messages()
 {
     if (in_array($this->session()->get('lang'), Config('admin.listTransLang'))) {
         return ['location_name.required' => trans('banner_messages.locationName') . ' ' . trans('error.required'), 'location_name.alpha_dash' => trans('banner_messages.locationName') . ' ' . trans('error.alpha_dash'), 'limit.required' => trans('banner_messages.limit') . ' ' . trans('error.required'), 'limit.integer' => trans('banner_messages.limit') . ' ' . trans('error.integer'), 'status.required' => trans('banner_messages.status') . ' ' . trans('error.required'), 'status.integer' => trans('banner_messages.status') . ' ' . trans('error.integer'), 'width.required' => trans('banner_messages.sizeWidth') . ' ' . trans('error.required'), 'width.integer' => trans('banner_messages.sizeWidth') . ' ' . trans('error.integer'), 'height.required' => trans('banner_messages.sizeHeight') . ' ' . trans('error.required'), 'height.integer' => trans('banner_messages.sizeHeight') . ' ' . trans('error.integer')];
     }
     return [];
 }
Пример #5
0
 public function send(Msg $msg)
 {
     // Get template file path.
     $templatePath = SPrintF('Notifies/SMS/%s.tpl', $msg->getTemplate());
     $smarty = JSmarty::get();
     if (!$smarty->templateExists($templatePath)) {
         throw new jException('Template file not found: ' . $templatePath);
     }
     $smarty->assign('Config', Config());
     foreach (array_keys($msg->getParams()) as $paramName) {
         $smarty->assign($paramName, $msg->getParam($paramName));
     }
     try {
         $message = $smarty->fetch($templatePath);
     } catch (Exception $e) {
         throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
     }
     $recipient = $msg->getParam('User');
     if (!$recipient['Params']['NotificationMethods']['SMS']['Address']) {
         throw new jException('Mobile phone number not found for user: '******'ID']);
     }
     $taskParams = array('UserID' => $recipient['ID'], 'TypeID' => 'SMS', 'Params' => array($recipient['Params']['NotificationMethods']['SMS']['Address'], $message, $recipient['ID'], $msg->getParam('ChargeFree') ? TRUE : FALSE));
     #Debug(SPrintF('[system/classes/SMS.class.php]: msg = %s,',print_r($msg,true)));
     $result = Comp_Load('www/Administrator/API/TaskEdit', $taskParams);
     switch (ValueOf($result)) {
         case 'error':
             throw new jException("Couldn't add task to queue: " . $result);
         case 'exception':
             throw new jException("Couldn't add task to queue: " . $result->String);
         case 'array':
             return TRUE;
         default:
             throw new jException("Unexpected error.");
     }
 }
Пример #6
0
 public function getBreadcrumbTpl($appendLinks = true, $separator = ' > ')
 {
     $links = [];
     $total = count($this->_breadcrumb);
     $index = 0;
     $currentPath = null;
     $base_url = Config('main')->ROUTING['BASE_URL'];
     foreach ($this->_breadcrumb as $level) {
         if (substr($level['link'], 0, 1) === '/') {
             $link = $base_url . substr($level['link'], 1);
         } else {
             $link = $level['link'];
         }
         if ($appendLinks) {
             $currentPath .= $link;
         } else {
             $currentPath = $link;
         }
         if (++$index < $total) {
             $links[] = '<a href="' . $currentPath . '">' . $level['label'] . '</a>';
         } else {
             $links[] = '<span>' . $level['label'] . '</span>';
         }
     }
     return join($separator, $links);
 }
Пример #7
0
 public function __construct($auth_other = null)
 {
     $this->auth_other = $auth_other;
     if ($this->auth_other === null) {
         $this->auth_other = Config('AUTH_OTHER');
     }
 }
Пример #8
0
 /**
  * 创建模型类
  * @param name 控制器名称
  * @author Colin <*****@*****.**>
  */
 public static function CreateModel($name)
 {
     $model = $name . Config('DEFAULT_MODEL_SUFFIX');
     $modelexplode = explode('\\', $name);
     //得到最后一个值
     $modelname = array_pop($modelexplode);
     return new $model($modelname);
 }
Пример #9
0
 /**
  * 获取文件名以及路径
  */
 protected function getFilenameOrPath($FileName)
 {
     if (empty($FileName)) {
         $FileName = METHOD_NAME;
     }
     $path = $this->view->template_dir . CONTROLLER_NAME . '/' . $FileName . Config('TPL_TYPE');
     return $path;
 }
Пример #10
0
 public function login(AuthenticateUser $authenticateUser, Request $request, $provider = null)
 {
     if (is_null($provider)) {
         return view(Config('constants.frontView') . '.login');
     } else {
         return $authenticateUser->execute(Request::all(), $this, $provider);
     }
 }
Пример #11
0
 protected function setArrayConfigProxy($keyConfigProxy = 'proxy')
 {
     $this->configProxy = [];
     if (class_exists('Config') && !is_null(Config($keyConfigProxy))) {
         //Verificação para config class do Laravel
         $this->configProxy = Config($keyConfigProxy);
     }
     return $this;
 }
Пример #12
0
 public function __construct()
 {
     $this->charset = Config('CODE_CHARSET');
     $this->codelen = Config('CODE_LENGTH');
     $this->width = Config('CODE_WIDTH');
     $this->height = Config('CODE_HEIGHT');
     $this->fontsize = Config('CODE_FONTSIZE');
     $this->font = Config('CODE_FONTPATH');
 }
Пример #13
0
 public function templateName()
 {
     $template = Config('lara-cms.master.template');
     if (isset($template[$this->template])) {
         return $template[$this->template];
     } else {
         return null;
     }
 }
Пример #14
0
 public function getKey()
 {
     $mac = shell_exec("ifconfig | awk '/eth/{print \$5}'");
     $ip = trim(`ifconfig eth0|grep -oE '([0-9]{1,3}\\.?){4}'|head -n 1`);
     $mac = trim(str_replace(':', '.', $mac));
     $domain = trim(str_replace(':', '.', \Config('app.www_domain')));
     $key = $domain . ':' . $mac . ':' . \Config('app.application_name') . ':' . (empty($_SESSION['enterprise_id']) ? 'sys' : $_SESSION['enterprise_id']);
     return $key;
 }
 public function edit()
 {
     //  dd(Helper::test());
     $attrs = Attribute::find(Input::get('id'));
     $attrSets = AttributeSet::get(['id', 'attr_set'])->toArray();
     $attr_types = AttributeType::all();
     $action = route("admin.attrs.save");
     return view(Config('constants.adminAttrView') . '.addEdit', compact('attrs', 'attrSets', 'action', 'attr_types'));
 }
function createMail($name)
{
    $url = Config('app.url');
    if (starts_with($url, 'http://')) {
        $domain = substr($url, 7);
        // $domain is now 'www.example.com'
        return $name . '@' . $domain;
    }
}
Пример #17
0
 public function __construct()
 {
     $this->file = new File();
     $this->cache_out_suffix = Config('CACHE_OUT_SUFFIX');
     $this->cache_out_prefix = Config('CACHE_OUT_PREFIX');
     $this->cache_data_dir = Config('CACHE_DATA_DIR');
     //检查目录的状态和权限
     $this->CacheDir();
 }
Пример #18
0
 /**
  * 验证路由规则
  * @author Colin <*****@*****.**>
  */
 public function CheckRoute()
 {
     if (Config('URL_MODEL') == 1) {
         $this->url->urlmodel1();
     } else {
         if (Config('URL_MODEL') == 2) {
             $this->url->urlmodel2();
         }
     }
 }
Пример #19
0
 /**
  * 分级书库
  *
  * @author Hunter.<*****@*****.**>
  */
 public function bookListAction($num = 16)
 {
     $this->thisController->tag->prependTitle('分级书库');
     $this->thisController->assign('grade_list', Config('CONFIG_GRADE'));
     $book_cate = self::$service->getBookCate();
     $this->thisController->assign('book_cate', $book_cate);
     $where = self::$service->getResultBookList();
     $integralShopList = self::$service->getBookList($where['whereArr'], $where['whereMap'], $this->thisController->user->id, $num);
     $this->thisController->assign('book_list', $integralShopList);
 }
Пример #20
0
function redisLink()
{
    static $r = false;
    if ($r) {
        return $r;
    }
    $r = new Redis(Config('redishost'), Config('redisport'));
    $r->connect();
    return $r;
}
Пример #21
0
 public function index($slug)
 {
     $category = Category::findBySlug($slug);
     $sizes = array_flatten(Attribute::where("attr", "Shoe Size")->first()->attributeoptions()->select('option_name')->get()->toArray());
     $parts = scandir(public_path() . "/Frontend/shoes/" . $category->folder);
     $parts = array_diff($parts, array('.', '..'));
     $savedList = User::find(Session::get('user')->id)->savedlist;
     //print_r($savedList);
     return view(Config('constants.frontView') . '.design', compact('category', 'parts', 'sizes', 'savedList'));
 }
Пример #22
0
 /**
  * $cfg->set_cache(
  *      'redis://'.Config('redis.servers.default'),
  *          'namespace' => Config('app.application_name').":orm",
  *          * array(
  *          'expire'    => 1200
  *      )
  *  );
  *  @param $options array()
  */
 public function __construct($options)
 {
     $options['port'] = isset($options['port']) ? $options['port'] : self::DEFAULT_PORT;
     $redis = new \Redis();
     $redis->connect($options['host'] . ":" . $options['port']);
     $auth = Config('redis.auth');
     if (!empty($auth)) {
         $redis->auth($auth);
     }
     $this->redis = $redis;
 }
Пример #23
0
 /**
  *分离获取要执行发送的类型列表
  **/
 public function getSenders($type)
 {
     $senders = Config('message.sender');
     $getSenders = array();
     foreach ($type as $v) {
         if (array_key_exists($v, $senders)) {
             $getSenders[$v] = $senders[$v];
         }
     }
     return $getSenders;
 }
Пример #24
0
 /**
  * 根据班级id/ids获取具体班级名称(多个)
  *
  * @return array
  * @author Hunter.<*****@*****.**>
  */
 public function getClassesName()
 {
     $classesId = $this->getClassesId();
     //根据当前用户的班级值获取对应的班级信息(包括年级)
     $classesInfo = Classes::find(['id IN ({id:array})', 'bind' => ['id' => $classesId]]);
     $className = [];
     foreach ($classesInfo as $k => $classes) {
         $className[$classes->getId()] = Config('CONFIG_GRADE')[$classes->getGradeId()] . $classes->getName();
     }
     return $className;
 }
Пример #25
0
 /**
  * 初始化
  * @param file 上传名称 例如 values('files' , 'img')
  */
 public function __construct($file)
 {
     $this->path = Config('UPLOAD_DIR');
     $this->allowtype = explode(',', Config('UPLOAD_TYPE'));
     $this->maxsize = Config('UPLOAD_MAXSIZE');
     $this->israndname = Config('UPLOAD_RANDNAME');
     //检查上传目录是否存在
     $this->checkFilePath();
     //初始化文件信息
     $this->file = $file;
 }
 public function edit()
 {
     $user = User::find(Input::get('id'));
     $action = "admin.systemusers.save";
     $roles = Role::get(['id', 'display_name'])->toArray();
     $roles_name = ["" => "Please Select"];
     foreach ($roles as $role) {
         $roles_name[$role['id']] = $role['display_name'];
     }
     return view(Config('constants.adminSystemUsersView') . '.addEdit', compact('user', 'action', 'roles_name'));
 }
Пример #27
0
 /**
  * Display a list of articles in a category.
  * @return string
  */
 public function showCategory()
 {
     $cms = Cms::newInstance();
     $view = 'newmarkets\\content::index';
     if (Config('content.show_category_latest')) {
         $view = 'newmarkets\\content::magazine';
     }
     $category = $this->getCategory();
     $articles = Article::listFromCategoryPublic($this->category->id);
     return view($view, compact('cms', 'category', 'articles'));
 }
Пример #28
0
function isAdmin()
{
    global $User;
    if (!isLoggedIn()) {
        return 0;
    }
    if (Config("adminuser") && $User['username'] == Config("adminuser")) {
        return 1;
    }
    return 0;
}
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     foreach (Config('predefined.users') as $name => $details) {
         $model = new \App\User();
         $model->name = $name;
         $model->id = $details['id'];
         $model->email = $details['email'];
         $model->password = bcrypt($details['password']);
         $model->created_at = \Carbon\Carbon::now();
         $model->save();
         isset($details['role']) ? $model->assignRole($details['role']) : $model->assignRole(Config('predefined.defaults.role'));
     }
 }
Пример #30
0
 public static function init()
 {
     //Define the project root in file system
     define('PROJECT_ROOT', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
     //Autoload application files
     self::_autoLoad();
     //Need to load Mime class at first
     require_once PROJECT_ROOT . DIRECTORY_SEPARATOR . 'system/Mime.class.php';
     //Load system files
     self::requireDirContent(PROJECT_ROOT . DIRECTORY_SEPARATOR . 'system');
     //Set some default values
     setlocale(LC_ALL, Config('main')->DEFAULT['LOCAL']);
     date_default_timezone_set(Config('main')->DEFAULT['TIMEZONE']);
 }