public function show($promo)
 {
     $pageTitle = $promo->name;
     $package = $promo;
     \JavaScript::put(['promo' => $promo]);
     return view('public.deals.show', compact('pageTitle'));
 }
Пример #2
0
 public function view()
 {
     $userRepo = App::make('Gruik\\Repo\\User\\UserInterface');
     $user = Sentry::getUser();
     $user->preferences = $userRepo->getPreferencesForUser($user->id);
     JavaScript::put(['user' => $user]);
     return View::make('auth.settings')->with('user', $user);
 }
 public function jsVars()
 {
     # Bind a variable called 'foo'
     JavaScript::put(['foo' => 'bar']);
     # Bind a variable called 'bar'
     JavaScript::put(['email' => Auth::user()->email]);
     return View::make('demo_jsVars');
 }
 public function __construct()
 {
     /* *
      *-------------------------------------------------------
      * Datepicker Default Date (custom.js file)
      *-------------------------------------------------------
      */
     \JavaScript::put(['minDate' => '2016/03/04']);
 }
Пример #5
0
 public function __construct()
 {
     /* *
      *-------------------------------------------------------
      *
      *-------------------------------------------------------
      */
     \JavaScript::put(['minDate' => '2016/03/04']);
 }
 /**
  * Register a Tungsten bootstrapped app for a given view
  *
  * @param  \View $main_view  Main view to nest into
  * @param  string $nest_as   Key to embed this view into the template
  * @param  string $template  Mustache template to render using
  * @param  string $data      Initial data to render with
  * @param  string $view      Name of the main View constructor registered in factory.js
  * @param  string $model     Name of the main Model constructor registered in factory.js
  */
 public static function register($main_view, $nest_as, $template, $data, $view, $model)
 {
     // Create unique ID for the element
     $id = 'App' . ++self::$counter;
     // Add bootstrap data to JS namespace
     \JavaScript::put([$id => ['view' => $view, 'model' => $model, 'template' => $template, 'data' => $data]]);
     // Nest a tungsten_wrapper view into the given key with the proper data
     $main_view->nest($nest_as, 'tungsten_wrapper', ['id' => $id, 'template_view' => $template, 'data' => $data]);
 }
Пример #7
0
 public function view($id)
 {
     $postRepo = App::make('Gruik\\Repo\\Post\\PostInterface');
     JavaScript::put(['disqus_username' => Config::get('gruik.disqus_username'), 'post' => $postRepo->byId($id)]);
     $post = $postRepo->byId($id);
     $diff = Carbon::now()->diffInMinutes(Carbon::parse($post->updated_at));
     $post->updated_at_human = Carbon::now()->subMinutes($diff)->diffForHumans();
     return View::make('front.view')->with('user', Sentry::getUser())->with('author', $post->user)->with('post', $post);
 }
Пример #8
0
 /**
  * Constructor is fired two events Controller_Init_Pre and CalledController_Init_Pre
  */
 public function __construct()
 {
     $this->view = view();
     $this->controller = get_called_class();
     $args = ['subject' => $this];
     notify(__CLASS__ . '_Init_Post', $args);
     notify($this->controller . '_Init_Post', $args);
     \JavaScript::put(['baseurl' => url(''), 'locale' => app()->getLocale(), 'i18n' => trans('javascript')]);
 }
Пример #9
0
 function init()
 {
     global $gorumroll;
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.curvycorners.js");
     JavaScript::addInclude(THEME_DIR . "/javascripts/modern.js");
     if (($gorumroll->list == "item" || $gorumroll->list == "user") && $gorumroll->method == "showdetails") {
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.preload.js");
         JavaScript::addOnload("\n          \$('.smallpic img').preload({\n              find:'small',\n              replace:'large'\n          });\n          \$('.smallpic a').hover(function(){\n              var dim = \$(this).find('img').attr('rel').split('x');\n              var src = \$(this).find('img').attr('src');\n              \$('.mainpic img').attr({\n                  src: src.replace('small','large'),\n                  width: dim[0],\n                  height: dim[1]\n              });\n              \$('.mainpic a').attr('href', this.href);\n          },function(){});\n        ");
     }
 }
Пример #10
0
 function showHtmlList()
 {
     global $lll;
     $_S =& new AppSettings();
     hasAdminRights($isAdm);
     if (!$isAdm) {
         LocationHistory::rollBack(new AppController("/"));
     }
     JavaScript::addCss(CSS_DIR . "/category.css");
     $catArr = array();
     $adminsettCtrl =& new AppController("settings/modify_form");
     $contentManagementCtrl =& new AppController("content/modify_form");
     $usersCtrl =& new AppController("user/list");
     $NotificationsCtrl =& new AppController("notification/list");
     $checkconfCtrl =& new AppController("checkconf/show");
     $checkUpdatesCtrl =& new AppController("checkconf/updates");
     $customListsCtrl =& new AppController("customlist/list");
     $rssCtrl =& new AppController("rss/modify_form/1");
     $purchaseItemCtrl =& new AppController("purchaseitem/sortfield_form");
     $pendingPurchaseItemsCtrl =& new AppController("purchaseitem/list");
     $ecommSettingsCtrl =& new AppController("ecommsettings/modify_form");
     $creditRulesCtrl =& new AppController("creditrule/list");
     $paymentRulesCtrl =& new AppController("paymentrule/list");
     $subscription_ttitleCtrl =& new AppController("subscription/list");
     $itemfield_ttitle_globalCtrl =& new AppController("field/sortfield_form/0");
     $items = array("adminsett", "contentManagement", "users", "Notifications", "customLists", "itemfield_ttitle_global", "checkUpdates");
     if (class_exists("rss")) {
         $items[] = "rss";
     }
     if ($_S->subscriptionType) {
         $items[] = "subscription_ttitle";
     }
     if ($_S->ecommerceEnabled()) {
         $_ES =& new ECommSettings();
         $items[] = "ecommSettings";
         if ($_ES->model == ecomm_advanced) {
             $items[] = "creditRules";
             $items[] = "purchaseItem";
         } else {
             $items[] = "paymentRules";
             $items[] = "pendingPurchaseItems";
         }
     }
     $i = 0;
     foreach ($items as $item) {
         $catArr[$i]->title = $lll[$item];
         $catArr[$i]->description = $lll["{$item}Description"];
         $catArr[$i]->link = ${$item . "Ctrl"}->makeUrl();
         $catArr[$i]->picture = "";
         $catArr[$i]->title = $lll[$item];
         $i++;
     }
     View::assign("categories", $catArr);
 }
Пример #11
0
 public function shop($id)
 {
     $page_title = "Shop";
     $barangs = Barang::where('kategori_id', $id)->where('published', 1)->paginate(20);
     $categories = Category::with('barang')->get();
     $aroma = DB::table('parfum')->select('id', 'nama')->orderBy('nama', 'ASC')->get();
     $bId = [1, 2, 3, 4, 83, 16, 17, 18, 9, 10, 11];
     $unpublished = [36, 15, 16];
     JavaScript::put(['aromas' => $aroma]);
     return View::make('store.shop', compact('barangs', 'categories', 'page_title', 'id', 'aroma', 'bId', 'unpublished'));
 }
Пример #12
0
 function createForm($elementName = "")
 {
     global $gorumroll, $lll;
     $_S =& new AppSettings();
     $this->cid = $gorumroll->rollid;
     $this->activateVariableFields();
     Object::createForm($elementName);
     JavaScript::addInclude(GORUM_JS_DIR . "/core.js");
     // a multipleSelectionManager miatt
     $_S->handleCategorySelect("itemsearch-create_form");
 }
Пример #13
0
 /**
  * Constructor IOSNotifications
  * @param mixed $title 
  * @param mixed $message 
  * @param double $delay [default value: 3000]
  */
 function __construct($title, $message, $delay = 3000)
 {
     $this->title = $title;
     $this->message = $message;
     $this->delay = $delay;
     $js = "";
     $js .= "ios.notify({\n  title: '" . addslashes($this->title) . "',\n  message: '" . addslashes($this->message) . "',\n  delay: '" . addslashes($this->delay) . "'\n});";
     parent::__construct($js);
     $this->addJavaScript(BASE_URL . "wsp/js/ios.notify.js", "", true);
     $this->addCss(BASE_URL . "wsp/css/ios-notify/ios.notify.css", "", true);
     $this->addCss(BASE_URL . "wsp/css/ios-notify/ios.notify.webkit.css");
 }
Пример #14
0
 /**
  * Composer for creating a new course
  *
  * @param View $view
  */
 public function compose(View $view)
 {
     $empty_link = new Link(['link' => "", 'name' => ""]);
     $empty_link->id = 0;
     \JavaScript::put(['links' => 0]);
     $view->with('empty_link', $empty_link);
     $view->with('categories', \Category::listCategories());
     $view->with('images', []);
     $view->with('videos', []);
     $view->with('ebooks', []);
     $view->with('links', []);
     $view->with('body', "");
 }
Пример #15
0
 function initializeSystemSettings()
 {
     global $dbHost, $dbUser, $dbUserPw, $dbName, $includeDumpJs;
     global $gorumroll, $speedStopWatch, $gorumview, $jQueryLib;
     $_GET = filterInput($_GET);
     $_COOKIE = filterInput($_COOKIE);
     $_SERVER = filterInput($_SERVER);
     $_FILES = filterInput($_FILES);
     if (class_exists("speedstat")) {
         $speedStopWatch = new Stopwatch();
         $speedStopWatch->start();
     }
     ini_set("session.use_cookies", 1);
     ini_set("session.use_only_cookies", 1);
     ini_set("session.use_trans_sid", 0);
     if (!session_id()) {
         session_start();
     }
     $this->kbfu = chr(103) . chr(111) . chr(114) . chr(117) . chr(109) . chr(117) . chr(115) . chr(101) . chr(114);
     $this->kbfk = chr(105) . chr(115) . chr(65) . chr(100) . chr(109);
     $this->kbfr = chr(103) . chr(111) . chr(114) . chr(117) . chr(109) . chr(114) . chr(101) . chr(99) . chr(111) . chr(103) . chr(110) . chr(105) . chr(115) . chr(101) . chr(100);
     // http://hu.php.net/manual/en/reserved.variables.session.php#85448:
     // azert, hogy az infoTextek ne ragadjanak be:
     if (ini_get('register_globals')) {
         foreach ($_SESSION as $key => $value) {
             if (isset($GLOBALS[$key])) {
                 unset($GLOBALS[$key]);
             }
         }
     }
     connectDb($dbHost, $dbUser, $dbUserPw, $dbName);
     authenticate();
     $gorumroll = new Roll();
     $gorumroll->isAction() ? include GORUM_DIR . "/gorum_action.php" : (include GORUM_DIR . "/gorum_view.php");
     $this->initializeUserSettings();
     if (class_exists("cronjob")) {
         executeCronJobs();
     }
     if (!$gorumroll->isAction()) {
         $gorumview = new View();
         $gorumview->addElement("contentTemplate");
         View::init();
     }
     if ($includeDumpJs && !$gorumroll->isAction()) {
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.dump.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/dump.js");
     }
     $this->kbf();
 }
Пример #16
0
 /**
  * Composer for updating a course
  * @param View $view
  */
 public function compose(View $view)
 {
     $course = $view->getData()['course'];
     $empty_link = new Link(['link' => "", 'name' => ""]);
     $empty_link->id = 0;
     $links = \Link::getAllLinks($course);
     $length = count($links) > 0 ? $links[count($links) - 1]->id + 1 : 1;
     \JavaScript::put(['links' => $length]);
     $view->with('empty_link', $empty_link);
     $view->with('images', \Image::listImages($course));
     $view->with('videos', \Video::listVideos($course));
     $view->with('ebooks', \Ebook::listEbooks($course));
     $view->with('links', $links);
     $view->with('body', \Resource::getCourseBody($course));
 }
Пример #17
0
 function init()
 {
     global $curvyCorners, $jQueryLib;
     if (!empty($curvyCorners)) {
         //JavaScript::addInclude(GORUM_DIR . "/js/niftycube.js");
         //JavaScript::addCss(GORUM_DIR . "/js/niftyCorners.css");
         //JavaScript::addOnload("
         //    Nifty('div.template','normal');
         //");
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.curvycorners.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.livequery.js");
         JavaScript::addOnload("\$.noah.addCurvyCornersToPresentationDivs();");
     }
 }
Пример #18
0
 public function explore()
 {
     $userRepo = App::make('Gruik\\Repo\\User\\UserInterface');
     $postRepo = App::make('Gruik\\Repo\\Post\\PostInterface');
     $tagRepo = App::make('Gruik\\Repo\\Tag\\TagInterface');
     $limit = Input::get('limit', 15);
     $posts = $postRepo->allPublicQuery()->with('tags')->with(['user' => function ($q) {
         $q->select('id', 'username');
     }])->orderBy('created_at', 'DESC')->paginate($limit);
     $posts->each(function ($post) {
         $diff = Carbon::now()->diffInMinutes(Carbon::parse($post->created_at));
         $post->created_at_human = Carbon::now()->subMinutes($diff)->diffForHumans();
     });
     JavaScript::put(['posts' => $posts->toArray()]);
     return View::make('front.explore')->with('posts', $posts)->with('user', Sentry::getUser());
 }
Пример #19
0
 /**
  * Composer for showing a course
  * @param View $view
  */
 public function compose(View $view)
 {
     $course = $view->getData()['course'];
     $view->with('course_categories', \Category::getCourseCategories($course));
     $view->with('images', \Image::listImagesWithCleanPath($course));
     $view->with('videos', \Video::listVideosWithCleanPath($course));
     $view->with('ebooks', \Ebook::listEbooksWithCleanPath($course));
     $view->with('links', \Link::listLinksWithNames($course));
     $view->with('created_at', \MyCarbon::format($course->created_at->diffForHumans()));
     $view->with('course_user', $course->user);
     $view->with('count_likes', \Course::countLikes($course));
     $view->with('count_dislikes', \Course::countDislikes($course));
     if (Auth::check()) {
         \JavaScript::put(['star_index' => \Course::getLikeRating($course, Auth::user())]);
     }
 }
Пример #20
0
 public function search()
 {
     $currentUser = Sentry::getUser();
     $userId = $currentUser ? $currentUser->id : null;
     $searchService = new SearchService();
     $term = trim(Input::get('q', ''));
     $type = Input::get('type', 'owner');
     $sortBy = Input::get('s', 'created_at,desc');
     if (!$term) {
         return View::make('front.search')->with('term', $term)->with('user', Sentry::getUser());
     }
     if (!$currentUser && $type == 'owner') {
         return Redirect::route('search', ['q' => Input::get('q'), 'type' => 'public']);
     }
     $countOwnerPosts = $searchService->searchPostsOwnerQuery($userId, $term)->count();
     $countPublicPosts = $searchService->searchPostsPublicQuery($userId, $term)->count();
     $countUsers = $searchService->searchUsersQuery($term)->count();
     switch ($type) {
         case 'public':
             $result = $searchService->searchPostsPublicQuery($userId, $term, $sortBy)->paginate(15);
             break;
         case 'users':
             $result = $searchService->searchUsersQuery($term, $sortBy)->leftJoin('posts', 'posts.user_id', '=', 'users.id')->addSelect(DB::raw('COUNT(posts.id) as public_posts'))->groupBy('users.id')->paginate(15);
             $result->getCollection()->map(function ($user) {
                 $user->avatar = Gravatar::src($user->email, 45);
                 $diff = Carbon::now()->diffInMinutes(Carbon::parse($user->created_at));
                 $user->created_at = Carbon::now()->subMinutes($diff)->diffForHumans();
                 unset($user->email);
             });
             break;
         case 'owner':
         default:
             $result = $searchService->searchPostsOwnerQuery($userId, $term, $sortBy)->paginate(15);
             break;
     }
     if ($type == 'public' || $type == 'owner') {
         $result->getCollection()->map(function ($post) {
             $diff = Carbon::now()->diffInMinutes(Carbon::parse($post->created_at));
             $post->created_at_human = Carbon::now()->subMinutes($diff)->diffForHumans();
         });
     }
     JavaScript::put(['result' => $result->toArray(), 'sortBy' => $sortBy]);
     $pagination = $result->appends(['q' => Input::get('q'), 'type' => Input::get('type'), 's' => Input::get('s'), 'o' => Input::get('o')])->links();
     return View::make('front.search')->with('term', $term)->with('user', Sentry::getUser())->with('countOwnerPosts', $countOwnerPosts)->with('countPublicPosts', $countPublicPosts)->with('countUsers', $countUsers)->with('pagination', $pagination)->with('result', $result);
 }
Пример #21
0
 function createForm()
 {
     global $gorumroll, $jQueryLib, $fieldset_typ;
     JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.dimensions.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/field.js");
     JavaScript::addInclude(JS_DIR . "/fieldset_form.js");
     $this->cid = $gorumroll->rollid;
     // A deleteAll es cloneToSubcats mezoket csak akkor tesszuk ki, ha van ertelmuk:
     getDbCount($subcatNum, array("SELECT COUNT(*) FROM @category WHERE up=#cid#", $this->cid));
     if (!$subcatNum || !$this->cid) {
         $fieldset_typ["attributes"]["cloneToSubcats"][] = "form invisible";
     }
     getDbCount($nonFixFieldNum, array("SELECT COUNT(*) FROM @customfield WHERE cid=#cid# AND columnIndex LIKE 'col_%'", $this->cid));
     if (!$nonFixFieldNum) {
         $fieldset_typ["attributes"]["deleteAll"][] = "form invisible";
     }
     parent::createForm();
 }
Пример #22
0
 public function profile($username)
 {
     $visited_user = User::where('username', $username)->first();
     if (!$visited_user) {
         return Redirect::to('/');
     }
     $userRepo = App::make('Gruik\\Repo\\User\\UserInterface');
     $postRepo = App::make('Gruik\\Repo\\Post\\PostInterface');
     $tagRepo = App::make('Gruik\\Repo\\Tag\\TagInterface');
     $limit = Input::get('limit', 10);
     $posts = $postRepo->byUserIdQuery($visited_user->id)->where('private', false)->with('tags')->orderBy('created_at', 'desc')->paginate($limit);
     $posts->each(function ($post) {
         $diff = Carbon::now()->diffInMinutes(Carbon::parse($post->created_at));
         $post->created_at_human = Carbon::now()->subMinutes($diff)->diffForHumans();
     });
     $diff = Carbon::now()->diffInMinutes(Carbon::parse($visited_user->last_login));
     $last_login = Carbon::now()->subMinutes($diff)->diffForHumans();
     JavaScript::put(['user' => $userRepo->toPublicArray($visited_user), 'posts' => $posts->toArray(), 'last_login' => $last_login, 'total_tags' => $tagRepo->publicByUserId($visited_user->id)->count(), 'total_days' => Carbon::now()->diffInDays(Carbon::parse($visited_user->created_at))]);
     return View::make('front.user_profile')->with('user', Sentry::getUser())->with('posts', $posts)->with('visited_user', $visited_user)->with('username', $username);
 }
Пример #23
0
 function CacheManager(&$base)
 {
     global $gorumroll, $language, $theme, $gorumrecognised, $gorumjavascript_cache, $gorumcategory;
     list($this->timeFrame, $categorySpecific) = $base->getCacheTimeFrameAndCategorySpecificity();
     if ($this->timeFrame) {
         $this->key = "{$gorumroll->list}-{$gorumroll->method}-{$gorumroll->rollid}-";
         $details = "language: {$language}, theme: {$theme}, authentication: ";
         hasAdminRights($isAdm);
         if ($isAdm) {
             $details .= "admin, ";
         } elseif ($gorumrecognised) {
             $details .= "loggedin, ";
         } else {
             $details .= "loggedout, ";
         }
         $s = new Sorting($base);
         $details .= " sorting: " . $s->getSortSql();
         $classVars = $gorumroll->getClassVars();
         if (!empty($classVars["off"])) {
             $details .= " offset: {$classVars['off']}";
         }
         if ($categorySpecific) {
             $details .= " category: {$gorumcategory}";
         }
         //FP::log($details, "Details");
         $this->key .= substr(md5($details), 0, 16);
         $this->fileName = CACHE_DIR . "/" . $this->key . '.html';
         $this->incFileName = CACHE_DIR . "/" . $this->key . '.inc';
         if ($this->checkCache()) {
             $inc = file_get_contents($this->incFileName);
             $gorumjavascript_cache = unserialize($inc);
             //FP::log($this, "Loading include cache");
             JavaScript::mergeCache($gorumjavascript_cache);
         } else {
             // Inicializaljuk az inklud kesst:
             $gorumjavascript_cache = new JavaScript();
             //FP::log($gorumjavascript_cache, "IncCache ujainit");
         }
     }
 }
Пример #24
0
 function getFormHeader(&$tpl)
 {
     global $gorumroll, $scriptName, $noFileUpload, $onSubmit;
     if (isset($this->typ["formid"])) {
         $formId = $hiddenFieldPrefix = $this->typ["formid"];
         $formAttrs = "id='{$formId}'";
     } else {
         $formId = "gorumForm";
         $hiddenFieldPrefix = "";
         $formAttrs = "id='gorumForm'";
     }
     if (!isset($noFileUpload)) {
         $formAttrs .= " ENCTYPE='multipart/form-data'";
     }
     $tpl->assign("formAttrs", $formAttrs);
     if ($onSubmit) {
         JavaScript::addEvent("#{$formId}", "submit", $onSubmit);
     }
     $tpl->assign("scriptName", $scriptName);
     // A kovetkezo method beallitasa:
     $ctrl =& new AppController(array("method" => str_replace("_form", "", $gorumroll->method)));
     $tpl->assign("hiddens", $ctrl->generHiddenFields($hiddenFieldPrefix));
     return $hiddenFieldPrefix;
 }
Пример #25
0
 public static function populateJsGlobalTtvTypeClearTextTrue()
 {
     $result = Schema::hasTable('testing_selenium_variables');
     if ($result) {
         $result = \DB::table('testing_selenium_variables')->select('ttvTypeClearText')->where('id', 1)->first();
         if ($result) {
             // if the test failed, we would have a testing_selenium_variables record; ttvTypeClearText needs to = 1.
             if ($result->ttvTypeClearText === 1) {
                 // jeffery way's package for moving php variables to the .js space.
                 // see https://github.com/laracasts/PHP-Vars-To-Js-Transformer.
                 // also see javascript.php in the config dir for view and .js namespace used.
                 \JavaScript::put(['ttvTypeClearText' => true]);
                 return true;
             }
         }
     }
     return false;
 }
Пример #26
0
 function handleEnumValueChange($stack = FALSE, $oldValue = FALSE, $newValue = FALSE)
 {
     if ($stack === FALSE) {
         if (!isset($_POST["optionValueModificationStack"]) || !count($stack = JavaScript::jsonDecode($_POST["optionValueModificationStack"]))) {
             return;
         }
         // ha nem vol modositas, vagy torles
     }
     if ($oldValue !== FALSE) {
         // ha propagate van, nem csak azokat a modositasokat kell figyelembe venni, amik az adott modifyban tortentek,
         // hanem a korabbiakat is. Ezt a 'values' regi es uj ertekenek osszehasonlitasaval erjuk el. Ha talalunk olyat,
         // ami nincs benne az uj 'values'-ban, azt hozzaadjuk $stack-hoz egy 'delete' action-nel:
         $oldValueArr = splitByCommas($oldValue, FALSE);
         // without HTML encoding
         $modified = array_unique(array_map(create_function('$v', 'return $v[0]=="modify" ? $v[1] : "";'), $stack));
         foreach ($oldValueArr as $val) {
             if (!in_array($val, $newValue) && !in_array($val, $modified)) {
                 $stack[] = array("delete", $val);
             }
         }
     }
     if (!$stack) {
         return;
     }
     // ha az old es new values osszehasonlitasa utan se derul ki, hogy lett volna torles v. modositas
     CustomField::addCustomColumns($this->getManagedTable());
     $affectedValues = array_map(create_function('$v', 'return quoteSQL(str_replace(",", ",,", $v[1]));'), $stack);
     $regexp = array();
     $columnIndex = G::getAttr($this->id, "itemfield", "columnIndex");
     foreach ($affectedValues as $v) {
         $regexp[] = "{$columnIndex} LIKE '%{$v}%'";
     }
     $whereCond = " WHERE (" . implode(" OR ", $regexp) . ")";
     if ($this->cid) {
         $whereCond .= " AND (cid={$this->cid} OR cid=0)";
     }
     $query = "SELECT id, {$columnIndex} FROM @" . $this->getManagedTable() . $whereCond;
     G::load($objs, $query);
     $customLists = new CustomList();
     $customLists->activateVariableFields();
     $query = "SELECT * FROM @search {$whereCond}";
     if (!loadObjectsSql($customLists, $query, $customLists)) {
         $objs = array_merge($objs, $customLists);
     }
     foreach ($objs as $obj) {
         $vals = splitByCommas($obj->{$columnIndex}, FALSE);
         $map = array_flip($vals);
         foreach ($stack as $action) {
             if (isset($map[$action[1]])) {
                 // modositjuk, ha modify, uresre allitjuk, ha delete:
                 $vals[$map[$action[1]]] = $action[0] == 'modify' ? $action[2] : "";
             }
         }
         $obj->{$columnIndex} = array_filter($vals);
         // removes the empty values
         if (is_a($obj, "search")) {
             $obj->modify(TRUE);
         } else {
             modify($obj);
         }
     }
 }
Пример #27
0
<?php

require_once 'JavaScript.class.php';
require_once 'HTM.class.php';
// ------
$attributes = array('href' => 'http://localhost', 'onclick' => "window.open(this.href,'_blank'); return false");
$link1 = HTM::a('Localhost New Tab', $attributes);
echo $link1;
echo HTM::br(2);
$array = array('href' => '#', 'onclick' => JavaScript::alert('test'));
$alert_link = HTM::a('Alert Link Text', $array);
/* div HTML */
$attr['id'] = 'div1';
$attr['class'] = 'recaptcha_only_if_incorrect_sol';
$attr['style'] = 'color:red;';
echo "\r\n";
echo HTM::div(HTM::span('Link: ', array('style' => 'font-weight:bold;')) . $alert_link, $attr);
// TODO: input
Пример #28
0
 function addJavaScripts()
 {
     if (isset($this->typ["jscripts"])) {
         if (is_array($this->typ["jscripts"])) {
             foreach ($this->typ["jscripts"] as $script) {
                 JavaScript::addScript($script());
             }
         } else {
             $script = $this->typ["jscripts"];
             JavaScript::addScript($script());
         }
     }
 }
Пример #29
0
 function doRegister()
 {
     global $gorumroll, $lll, $gorumuser, $noahsRegisterScript, $noahsHost, $noahVersion;
     hasAdminRights($isAdm);
     if (!$isAdm) {
         LocationHistory::rollBack(new AppController("/"));
     }
     JavaScript::addCss(CSS_DIR . "/checkconf.css?{$noahVersion}");
     $_GS = new GlobalStat();
     if (!$_GS->reg) {
         $_GS->reg = md5(uniqid(rand(), true));
     }
     $_GS->company = $_POST["company"];
     $_GS->firstName = $_POST["firstName"];
     $_GS->lastName = $_POST["lastName"];
     $_GS->email = $_POST["email"];
     $data = $this->getTransferData($_GS, TRUE);
     if (($result = $this->getVersionInfo($noahsHost, "POST", $noahsRegisterScript, $data)) === FALSE) {
         View::assign("checkTitle", $lll["unableToConnectNoah"]);
     } else {
         if (strstr($result, "Registration:OK")) {
             View::assign("checkTitle", $lll["noahRegistrationSuccessfull"]);
             $_GS->registered = TRUE;
         } else {
             View::assign("checkTitle", $lll["noahRegistrationFalseResponse"]);
         }
     }
     modify($_GS);
     View::assign("report", array());
 }
Пример #30
0
 function OverlayController($param = 0, $id = 0)
 {
     global $lll, $gorumroll;
     static $counter = 0;
     static $objects = array();
     if (!$param) {
         return;
     }
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.overlay.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.livequery.js");
     JavaScript::addCss(CSS_DIR . "/overlay.css");
     // $ajaxTarget-be gyujtjul a load fuggveny parameteret:
     $text = $ajaxTarget = "";
     if (is_string($param)) {
         $this->id = $id ? $id : "overlay_" . $counter++;
         $this->triggerSelector = "[rel=#{$this->id}]";
         $text = isset($lll[$param]) ? $lll[$param] : $param;
     } elseif (is_object($param)) {
         $this->id = $id ? $id : "overlay_" . $counter++;
         $this->triggerSelector = "[rel=#{$this->id}]";
         $ajaxTarget = "'" . $param->makeUrl() . "'";
     } else {
         if (isset($param["id"])) {
             $this->id = $param["id"];
             if (array_key_exists($this->id, $objects)) {
                 foreach (get_object_vars($objects[$this->id]) as $attr => $value) {
                     $this->{$attr} =& $objects[$this->id]->{$attr};
                 }
                 return;
             }
         } else {
             $this->id = "overlay_" . $counter++;
         }
         if (isset($param["class"])) {
             $this->class = $param["class"];
         }
         if (isset($param["ajaxFromHref"])) {
             $this->ajaxFromHref = $param["ajaxFromHref"];
         }
         if (isset($param["ajaxFromContent"])) {
             $this->ajaxFromContent = $param["ajaxFromContent"];
         }
         if (isset($param["triggerSelector"])) {
             $this->triggerSelector = $param["triggerSelector"];
         } else {
             $this->triggerSelector = "[rel=#{$this->id}]";
         }
         if (isset($param["content"])) {
             if (is_string($param["content"])) {
                 if (substr($param["content"], 0, 6) == "http://") {
                     $ajaxTarget = "'{$param['content']}'";
                 } elseif ($this->ajaxFromContent) {
                     $ctrl =& new AppController($param["content"]);
                     $ajaxTarget = "'" . $ctrl->makeUrl() . "'";
                 } else {
                     $text = isset($lll[$param["content"]]) ? $lll[$param["content"]] : $param["content"];
                 }
             } elseif (is_array($param["content"])) {
                 $text = call_user_func($param["content"]);
             } elseif (is_object($param["content"])) {
                 if ($this->ajaxFromContent) {
                     $ajaxTarget = "'" . $param["content"]->makeUrl() . "'";
                 } else {
                     $gorumroll->processMethod($param["content"], $this->id);
                     $tpl =& View::getView($this->id);
                     $text = $tpl->__toString();
                 }
             }
         }
         if ($this->ajaxFromHref) {
             $ajaxTarget = "this.getTrigger().attr('href')";
         }
         if (isset($param["expose"])) {
             $this->expose = $param["expose"];
         }
         if (isset($param["closeOnClick"])) {
             $this->closeOnClick = $param["closeOnClick"];
         }
         $this->closeOnClick = $this->closeOnClick ? 'true' : 'false';
         if (isset($param["postponeOnloadAction"])) {
             $this->postponeOnloadAction = $param["postponeOnloadAction"];
         }
         if (isset($param["speed"])) {
             $this->speed = $param["speed"];
         }
         if (isset($param["top"])) {
             $this->top = $param["top"];
         }
         if (isset($param["height"])) {
             $this->height = $param["height"];
         }
         if (isset($param["close"])) {
             $this->close = $param["close"];
         }
         if ($this->expose) {
             JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.expose.js");
             $this->onBeforeLoad = "function() { \n                this.getBackgroundImage().expose({\n                    speed: {$this->speed}, \n                    color: '#fff',\n                    closeOnClick: {$this->closeOnClick}\n                }); \n                /*insertionPoint*/\n            }";
             $this->onClose = "function() { \n                \$.expose.close();\t\t\t\n                /*insertionPoint*/\n            }";
         }
     }
     if ($ajaxTarget) {
         $onBeforeLoadForAjax = "\n            this.getContent().find('.ajaxOverlayContent').load({$ajaxTarget}, '', function(){\n                \$(this).find('.submitfooter input').eq(1).click( function() { \n                    \$('{$this->triggerSelector}').overlay().close(); \n                    return false; \n                });\n            }); \n            /*insertionPoint*/\n        ";
         if ($this->onBeforeLoad != 'null') {
             $this->onBeforeLoad = str_replace("/*insertionPoint*/", $onBeforeLoadForAjax, $this->onBeforeLoad);
         } else {
             $this->onBeforeLoad = "function() { {$onBeforeLoadForAjax} }";
         }
         $ajaxOverlayContent = "<div class='ajaxOverlayContent'></div>";
     } else {
         $ajaxOverlayContent = "";
     }
     // ha parameterben erkeznek callback JS sorok, akkor azokat a fentebb definialt callback body-k utan szurjuk be az /*insertionPoint*/ helyere:
     foreach (array("onLoad", "onBeforeLoad", "onClose") as $callback) {
         if (is_array($param) && isset($param[$callback]) && $this->{$callback} != 'null') {
             $this->{$callback} = str_replace("/*insertionPoint*/", $param[$callback], $this->{$callback});
         } elseif (is_array($param) && isset($param[$callback])) {
             $this->{$callback} = $param[$callback];
         } elseif ($this->{$callback} != 'null') {
             $this->{$callback} = str_replace("/*insertionPoint*/", "", $this->{$callback});
         }
     }
     // ajaxFromHref eseten, ha content-ben atadunk valamit, azt be lehet szurni az Ajax tartalom ele:
     $this->content = "<div id='{$this->id}' class='{$this->class}' style='height: {$this->height}px;'> \\\n                         <div class='close'></div>" . preg_replace("/\n|\r/", "", addcslashes($text, '"')) . "{$ajaxOverlayContent} \\\n                     </div>";
     $this->prependAction = "\$('body').prepend(\"{$this->content}\");";
     //var_dump($this->closeOnClick);
     $this->overlayAction = "\n    \$('{$this->triggerSelector}').livequery(function(){ \$(this).overlay({\n            onLoad: {$this->onLoad}, \n            onBeforeLoad: {$this->onBeforeLoad}, \n            onClose: {$this->onClose},\n            closeOnClick: {$this->closeOnClick},\n            speed: {$this->speed},\n            close: '{$this->close}'\n            });});\n    ";
     if (!$this->postponeOnloadAction) {
         JavaScript::addOnload($this->prependAction, $this->id);
         JavaScript::addOnload($this->overlayAction, $this->triggerSelector);
     }
     if (!isset($objects[$this->id])) {
         $objects[$this->id] = $this;
     }
 }