public function actionEdit($type = false) { $cid = Request::getVar('cid', ""); setSysConfig("sidebar.display", 0); $this->addIconToolbar("Save", Router::buildLink('articles', array('layout' => 'apply')), "apply"); $this->addIconToolbar("Save & Close", Router::buildLink('articles', array('layout' => 'save')), "save"); $this->addIconToolbar("Save & New", Router::buildLink('articles', array('layout' => 'savenew')), "plus"); $this->addIconToolbar("Save as Copy", Router::buildLink('articles', array('layout' => 'savecopy')), " fa fa-copy"); if ($cid == 0) { $this->pageTitle = "New article"; $this->addBarTitle("Article <small>[New]</small>", "user"); $this->addIconToolbar("Close", Router::buildLink("articles", array('layout' => 'cancel')), "cancel"); } else { $this->addIconToolbar("Cancel", Router::buildLink("articles", array('layout' => 'cancel')), "cancel"); $this->pageTitle = "Edit article"; $this->addBarTitle("Article <small>[Edit]</small>", "user"); } $model = Article::getInstance(); $item = $model->getItem($cid); global $user; if (!($bool = $user->modifyChecking($item->created_by))) { $obj_users = YiiUser::getInstance(); $item_user = $obj_users->getUser($item->created_by); YiiMessage::raseNotice("Your account not have permission to edit resource of: {$item_user->username}"); $this->redirect(Router::buildLink("articles")); return false; } $data['item'] = $item; $data['list'] = $model->getListEdit($item); $this->render('edit', $data); }
public function actionEdit() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to add/edit menu"); $this->redirect(Router::buildLink("cpanel")); } setSysConfig("sidebar.display", 0); $obj_menu = YiiMenu::getInstance(); $this->addIconToolbar("Save", Router::buildLink('menus', array("view" => "menutype", 'layout' => 'save')), "save"); $this->addIconToolbar("Apply", Router::buildLink('menus', array("view" => "menutype", 'layout' => 'apply')), "apply"); $items = array(); $cid = Request::getVar("cid", 0); if (is_array($cid)) { $cid = $cid[0]; } if ($cid == 0) { $this->addIconToolbar("Cancel", Router::buildLink('menus', array("view" => "menutype", 'layout' => 'cancel')), "cancel"); $this->addBarTitle("Menu types <small>[New]</small>", "user"); $this->pageTitle = "New menu"; } else { $this->addIconToolbar("Close", Router::buildLink('menus', array("view" => "menutype", 'layout' => 'cancel')), "cancel"); $this->addBarTitle("Menu type <small>[Edit]</small>", "user"); $this->pageTitle = "Edit menu"; } $obj_tblMenu = $obj_menu->loadMenu($cid, "*", false); $this->render('edit', array("obj_tblMenu" => $obj_tblMenu)); }
public function actionDisplay() { $id = Request::getVar('id', null); $alias = Request::getVar('alias', null); $model = Video::getInstance(); if ($id == null or $id == "") { if ($alias != null and $alias != "") { $obj_item = $model->getItemByAlias($alias); } else { header("Location: /"); } } else { $obj_item = $model->getItem($id); } $items = $model->getItems($obj_item['catID'], true, 4); $items2 = $model->getItems($obj_item['catID'], false, 9); $obj_category = $model->getCategory($obj_item['catID']); $data['item'] = $obj_item; $data['items'] = $items; $data['items2'] = $items2; $data['category'] = $obj_category; $page_title = $obj_item['title']; $page_keyword = $obj_item['metakey'] != "" ? $obj_item['metakey'] : $page_title; $page_description = $obj_item['metadesc'] != "" ? $obj_item['metadesc'] : $page_title; setSysConfig("seopage.title", $page_title); setSysConfig("seopage.keyword", $page_keyword); setSysConfig("seopage.description", $page_description); Request::setVar('alias', $obj_category['alias']); $this->render('default', $data); }
public function actionEdit() { global $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to add/edit location"); $this->redirect(Router::buildLink("locations")); } setSysConfig("sidebar.display", 0); $this->addIconToolbar("Save", Router::buildLink("locations", array("layout" => "save")), "save"); $this->addIconToolbar("Apply", Router::buildLink("locations", array("layout" => "apply")), "apply"); $items = array(); $cid = Request::getVar("cid", 0); if (is_array($cid)) { $cid = $cid[0]; } if ($cid == 0) { $this->addIconToolbar("Cancel", Router::buildLink("locations", array("layout" => "cancel")), "cancel"); $this->addBarTitle("Location <small>[New]</small>", "user"); $this->pageTitle = "New location"; } else { $this->addIconToolbar("Close", Router::buildLink("locations", array("layout" => "cancel")), "cancel"); $this->addBarTitle("Location <small>[Edit]</small>", "user"); $this->pageTitle = "Edit location"; } $model = Location::getInstance(); $item = $model->getItem(); $lists = $model->getListEdit($item); $this->render('edit', array("item" => $item, "lists" => $lists)); }
public function actionEdit() { $cid = Request::getVar('cid', ""); setSysConfig("sidebar.display", 0); $this->addIconToolbar("Save", Router::buildLink('categories', array('layout' => 'apply')), "apply"); $this->addIconToolbar("Save & Close", Router::buildLink('categories', array('layout' => 'save')), "save"); $this->addIconToolbar("Save & New", Router::buildLink('categories', array('layout' => 'savenew')), "plus"); $this->addIconToolbar("Save as Copy", Router::buildLink('categories', array('layout' => 'savecopy')), " fa fa-copy"); if ($cid == 0) { $this->addBarTitle("Category <small>[New]</small>", "user"); $this->pageTitle = "New menu item"; $this->addIconToolbar("Cancel", Router::buildLink("categories", array("layout" => "cancel")), "cancel"); } else { $this->addBarTitle("Category <small>[Edit]</small>", "user"); $this->pageTitle = "Edit menu item"; $this->addIconToolbar("Close", Router::buildLink("categories", array("layout" => "cancel")), "cancel"); } $obj = YiiCategory::getInstance(); $item = $obj->loadItem($cid, "*", false); $model = Categories::getInstance(); $lists = $model->getListEdit($item); // chi useradmin moi duoc tao/sua global $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to add/edit category"); $this->redirect(Router::buildLink("categories")); } $this->render('edit', array("item" => $item, "lists" => $lists)); }
public function actionEdit() { global $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to add/edit group"); $this->redirect(Router::buildLink("users", array('view' => 'group'))); } setSysConfig("sidebar.display", 0); $this->addIconToolbar("Save", Router::buildLink("users", array("view" => "group", "layout" => "save")), "save"); $this->addIconToolbar("Apply", Router::buildLink("users", array("view" => "group", "layout" => "apply")), "apply"); $items = array(); $cid = Request::getVar("cid", 0); if (is_array($cid)) { $cid = $cid[0]; } if ($cid == 0) { $this->addIconToolbar("Cancel", Router::buildLink("users", array("view" => "group", "layout" => "cancel")), "cancel"); $this->addBarTitle("User group <small>[New]</small>", "user"); $this->pageTitle = "New group"; } else { $this->addIconToolbar("Close", Router::buildLink("users", array("view" => "group", "layout" => "cancel")), "cancel"); $this->addBarTitle("User group <small>[Edit]</small>", "user"); $this->pageTitle = "Edit group"; } $model = new Group(); $model_resource = Resource::getInstance(); $item = $model->getItem(); $lists = $model->getListEdit($item); $arr_resource = $model_resource->getItems(); $all_granted = $model->getGranted(); $this->render('edit', array("item" => $item, "lists" => $lists, 'arr_resource' => $arr_resource, "all_granted" => $all_granted)); }
public function actionDisplay() { $model = Article::getInstance(); $params["items"] = $model->getTinTuc(); $page_title = "wapsite - trang tin tức tổng hợp nhanh nhất"; setSysConfig("seopage.title", $page_title); setSysConfig("seopage.keyword", $page_title); setSysConfig("seopage.description", $page_title); $this->render('default', $params); }
public function actionDisplay() { global $classSuffix, $db, $user, $mainframe; $model = HomeModel::getInstance(); $data["items_videos"] = $model->getVideos(5); $data["items_news"] = $model->getLastNews(5); // $data['news'] = $list_category; setSysConfig("seopage.title", "wapsite - trang tổng hợp video, tin tức mới nhất"); setSysConfig("seopage.keyword", "wapsite, tổng hợp video, tin tức mới nhất"); setSysConfig("seopage.description", "wapsite - trang tổng hợp video, tin tức mới nhất"); $this->render('default', $data); }
public function actionEdit() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to edit menu item"); $this->redirect(Router::buildLink("menus", array("view" => 'menutype'))); } $menuID = Request::getInt('menu', ""); if ($menuID <= 0) { YiiMessage::raseWarning("Invalid menu id"); $this->redirect(Router::buildLink('menus', array("view" => "menutype"))); } $this->addIconToolbar("Save", Router::buildLink('menus', array("view" => "menuitem", 'menu' => $menuID, 'layout' => 'apply')), "apply"); $this->addIconToolbar("Save & Close", Router::buildLink('menus', array("view" => "menuitem", 'menu' => $menuID, 'layout' => 'save')), "save"); $this->addIconToolbar("Save & New", Router::buildLink('menus', array("view" => "menuitem", 'menu' => $menuID, 'layout' => 'savenew')), "plus"); $this->addIconToolbar("Save as Copy", Router::buildLink('menus', array("view" => "menuitem", 'menu' => $menuID, 'layout' => 'savecopy')), " fa fa-copy"); $items = array(); setSysConfig("sidebar.display", 0); $cid = Request::getVar("cid", 0); $menuID = Request::getInt('menu', ""); if ($menuID <= 0) { YiiMessage::raseWarning("Invalid menu id"); $this->redirect(Router::buildLink('menus', array("view" => "menutype"))); } if (is_array($cid)) { $cid = $cid[0]; } $obj_menu = YiiMenu::getInstance(); if ($cid == 0) { $this->addBarTitle("Menu item <small>[New]</small>", "user"); $this->pageTitle = "New menu item"; $this->addIconToolbar("Cancel", Router::buildLink('menus', array("view" => "menuitem", 'menu' => $menuID, 'layout' => 'cancel')), "cancel"); } else { $this->addBarTitle("Menu item <small>[Edit]</small>", "user"); $this->pageTitle = "Edit menu item"; $this->addIconToolbar("Close", Router::buildLink('menus', array("view" => "menuitem", 'menu' => $menuID, 'layout' => 'cancel')), "cancel"); } $obj_tblMenuItem = $obj_menu->loadItem($cid); $model = MenuItem::getInstance(); $list = $model->getListEdit($obj_tblMenuItem); if ($obj_tblMenuItem->params != "") { $obj_tblMenuItem->params = json_decode($obj_tblMenuItem->params); } else { $obj_tblMenuItem->params = null; } $params = array("item" => $obj_tblMenuItem, "list" => $list); $this->render('edit', $params); }
function actionEdit() { global $user; setSysConfig("sidebar.display", 0); $model = new Users(); $cid = Request::getVar("cid", 0); if (is_array($cid)) { $cid = $cid[0]; } $this->addIconToolbar("Save", Router::buildLink("users", array("view" => "user", 'layout' => 'save')), "save"); $this->addIconToolbar("Apply", Router::buildLink("users", array("view" => "user", 'layout' => 'apply')), "apply"); if ($cid == 0) { $this->addIconToolbar("Cancel", Router::buildLink("users", array("view" => "user", 'layout' => 'cancel')), "cancel"); $this->addBarTitle("User <small>[New]</small>", "user"); $this->pageTitle = "New User"; } else { $this->addIconToolbar("Close", Router::buildLink("users", array("view" => "user", 'layout' => 'cancel')), "cancel"); $this->addBarTitle("User <small>[Edit]</small>", "user"); $this->pageTitle = "Edit User"; } $model = new Users(); $model_resource = Resource::getInstance(); $item = $model->getItem($cid); if ($item->id != 0) { // account da duoc tao if (!($bool = $user->modifyChecking($item->id))) { // user leader nhom cha if ($item->status != -1) { // user da duoc active thi khong duoc thay doi YiiMessage::raseNotice("Your account not have permission to modify this account"); $this->redirect(Router::buildLink("cpanel")); } } // => user da active thi chi user do va superadmin moi thay doi thong tin } else { if ($user->leader == 0) { // neu khong phai leader thi khong duoc tao acc moi YiiMessage::raseNotice("Your account not have permission to make account"); $this->redirect(Router::buildLink("cpanel")); } } $arr_resource = $model_resource->getItems(); $all_granted = $model->getGranted(); $lists = $model->getListEdit($item); $this->render('edit', array("item" => $item, "lists" => $lists, 'arr_resource' => $arr_resource, "all_granted" => $all_granted)); }
public function actionDisplay() { $cid = Request::getVar('id', null); $alias = Request::getVar('alias', null); $model = Article::getInstance(); $obj_item = $model->getItem($cid, $alias); $obj_category = $model->getCategory($obj_item['catID']); $data['item'] = $obj_item; $data['category'] = $obj_category; $page_title = $obj_item['title']; $page_keyword = $obj_item['metakey'] != "" ? $obj_item['metakey'] : $page_title; $page_description = $obj_item['metadesc'] != "" ? $obj_item['metadesc'] : $page_title; setSysConfig("seopage.title", $page_title); setSysConfig("seopage.keyword", $page_keyword); setSysConfig("seopage.description", $page_description); $this->render('default', $data); }
public function actionEdit($type = false) { $cid = Request::getVar('cid', ""); if (is_array($cid)) { $cid = $cid[0]; } setSysConfig("sidebar.display", 0); $this->addIconToolbar("Save", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'save')), "save"); $this->addIconToolbar("Apply", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'apply')), "apply"); $this->addBarTitle("Permission <small>[Edit]</small>", "user"); $this->addIconToolbar("Close", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'cancel')), "cancel"); $this->pageTitle = "Edit resource"; $model = Resource::getInstance(); $item = $model->getItem($cid); $data['lists'] = $model->getListEdit($item); $data['item'] = $item; $this->render('edit', $data); }
function init() { global $db, $user, $mainframe, $hideMenu; setSysConfig("sidebar.display", 1); $task = Request::getVar("task", ""); if ($task != "") { $cmd = "action{$task}()"; if (method_exists($this, $cmd)) { $this->{$cmd}(); } } $db = $this->db = Yii::app()->db; Yii::app()->name = "Back end"; $user = $this->user = Yii::app()->session['userbackend']; if (is_object($user)) { $user->reloaUserLogin(); } $mainframe = MainFrame::getInstance($this->db, $user); parent::init(); $copyright = isset(Yii::app()->params->copyright) ? Yii::app()->params->copyright : 0; $timeout = isset(Yii::app()->params->timeout) ? Yii::app()->params->timeout : 900; // 15 phut $timeout2 = isset(Yii::app()->params->timeout2) ? Yii::app()->params->timeout2 : 1800; // 30 phut $YiiApp = Yii::app(); if (!$mainframe->isLogin()) { $duration = time() + $timeout; // 365 days } else { $permission = isset(Yii::app()->params->permission) ? Yii::app()->params->permission : 1; if ($permission == 1) { CheckPerMission::checking(); } $remember_admin = (isset($_COOKIE['remember_admin']) and $_COOKIE['remember_admin'] == 1) ? 1 : 0; if ($remember_admin == 1) { $duration = time() + $timeout2; } else { $duration = time() + $timeout; } // 15 minutes } $cookie = new CHttpCookie(session_name(), session_id(), array("expire" => $duration)); $YiiApp->getRequest()->getCookies()->add($cookie->name, $cookie); }
function importXML($file) { global $opt; $xr = new XMLReader(); if (!$xr->open($file)) { $xr->close(); return; } $xr->read(); if ($xr->nodeType != XMLReader::ELEMENT) { echo 'error: First element expected, aborted' . "\n"; return; } if ($xr->name != 'gkxml') { echo 'error: First element not valid, aborted' . "\n"; return; } $startupdate = $xr->getAttribute('date'); if ($startupdate == '') { echo 'error: Date attribute not valid, aborted' . "\n"; return; } while ($xr->read() && !($xr->name == 'geokret' || $xr->name == 'moves')) { } $nRecordsCount = 0; do { if ($xr->nodeType == XMLReader::ELEMENT) { $element = $xr->expand(); switch ($xr->name) { case 'geokret': $this->importGeoKret($element); break; case 'moves': $this->importMove($element); break; } $nRecordsCount++; } } while ($xr->next()); $xr->close(); setSysConfig('geokrety_lastupdate', date($opt['db']['dateformat'], strtotime($startupdate))); }
public function actionEdit() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to add/edit module"); $this->redirect(Router::buildLink("cpanel")); } $cid = Request::getVar('cid', ""); setSysConfig("sidebar.display", 0); //check boolean id $model = Module::getInstance(); $item = $model->getItem($cid); $lists = $model->getListEdit($item); $this->addIconToolbar("Save", Router::buildLink("modules", array("layout" => "save")), "save"); $this->addIconToolbar("Apply", Router::buildLink("modules", array("layout" => "apply")), "apply"); $this->addBarTitle("Module <small>[Edit]</small>", "user"); $this->addIconToolbar("Close", Router::buildLink("modules", array("layout" => "cancel")), "cancel"); $this->pageTitle = "Edit module"; $this->render('edit', array("item" => $item, "lists" => $lists)); }
public function actionEdit() { $cid = Request::getVar('cid', ""); setSysConfig("sidebar.display", 0); $this->addIconToolbar("Save", Router::buildLink("videos", array('layout' => 'save')), "save"); $this->addIconToolbar("Apply", Router::buildLink("videos", array('layout' => 'apply')), "apply"); $this->addBarTitle("Video <small>[Edit]</small>", "user"); $this->addIconToolbar("Close", Router::buildLink("videos", array('layout' => 'cancel')), "cancel"); $this->pageTitle = "Edit video"; $model = Video::getInstance(); $item = $model->getItem($cid); global $user; if (!($bool = $user->modifyChecking($item->created_by))) { $obj_users = YiiUser::getInstance(); $item_user = $obj_users->getUser($item->created_by); YiiMessage::raseNotice("Your account not have permission to edit resource of: {$item_user->username}"); $this->redirect(Router::buildLink("article")); return false; } $list = $model->getListEdit($item); $this->render('edit', array("item" => $item, "list" => $list)); }
public function actionBlog() { $model = Article::getInstance(); $catAlias = Request::getVar('alias', null); $currentPage = Request::getVar('page', 1); $limit = 12; $data['alias'] = $catAlias; $catID = Request::getVar("id"); $obj_category = $model->getCategory($catID, $catAlias); if ($obj_category == false) { $this->redirect($this->createUrl("articles/")); } $start = ($currentPage - 1) * $limit; $obj_category['items'] = $model->getArticlesCategoy($obj_category['id'], $start, $limit); if ($obj_category['total'] > $start + $limit) { $page = $currentPage + 1; } else { $page = $currentPage - 1; } $catAlias = $obj_category['alias']; if ($page > 1) { $obj_category['pagemore'] = Yii::app()->createUrl("articles/category", array("alias" => $catAlias, "page" => $page)); } elseif ($page == 1) { $obj_category['pagemore'] = Yii::app()->createUrl("articles/category", array("alias" => $catAlias)); } $page_title = $obj_category['title']; if ($currentPage > 1) { $page_title = $page_title . " trang {$currentPage}"; } $page_keyword = $obj_category['metakey'] != "" ? $obj_category['metakey'] : $page_title; $page_description = $obj_category['metadesc'] != "" ? $obj_category['metadesc'] : $page_title; setSysConfig("seopage.title", $page_title); setSysConfig("seopage.keyword", $page_keyword); setSysConfig("seopage.description", $page_description); $data['category'] = $obj_category; $this->render('default', $data); }
public function actionBlog() { $model = Video::getInstance(); $catAlias = Request::getVar('alias', null); $catID = Request::getVar("id"); $currentPage = Request::getVar('page', 1); $limit = 12; $data['alias'] = $catAlias; $obj_category = $model->getCategory($catID, $catAlias); if ($obj_category == false) { $this->redirect(Router::buildLink('videos')); } if ($currentPage == 1) { $data['items'] = $model->getItems($obj_category['id'], true, 5); } $start = ($currentPage - 1) * $limit; $data['items2'] = $model->getItems($obj_category['id'], false, $limit, $start); if ($obj_category['total'] > $start + $limit) { $page = $currentPage + 1; } else { $page = $currentPage - 1; } $catAlias = $obj_category['alias']; $params = array("view" => "category", "id" => $obj_category['id'], "alias" => $obj_category['alias'], "page" => $page); $obj_category['pagemore'] = Router::buildLink('videos', $params); $page_title = $obj_category['title']; if ($currentPage > 1) { $page_title = $page_title . " trang {$currentPage}"; } $page_keyword = $obj_category['metakey'] != "" ? $obj_category['metakey'] : $page_title; $page_description = $obj_category['metadesc'] != "" ? $obj_category['metadesc'] : $page_title; setSysConfig("seopage.title", $page_title); setSysConfig("seopage.keyword", $page_keyword); setSysConfig("seopage.description", $page_description); $data['category'] = $obj_category; $this->render('blog', $data); }
function importxmlfile($file) { echo 'Importing file ' . $file . "\n"; $xmlReader = new xmlReader(); $xmlReader->open($file); $xmlReader->read(); if ($xmlReader->nodeType != XMLReader::DOC_TYPE) { echo 'error: DOCTYPE expected, aborted'; return false; } if ($xmlReader->name != 'oc11xml') { echo 'error: wrong DOCTYPE, aborted'; return false; } $xmlReader->read(); if ($xmlReader->nodeType != XMLReader::ELEMENT) { echo 'error: First element expected, aborted'; return false; } if ($xmlReader->name != 'oc11xml') { echo 'error: first element not valid, aborted'; return false; } $xmlReader->moveToFirstAttribute(); while ($xmlReader->name != 'date' && $xmlReader->moveToNextAttribute()) { } if ($xmlReader->name == 'date') { $starttime = strtotime($xmlReader->value); } else { $starttime = strtotime('2005-08-01 00:00:00'); } // ok ... machen wir mal ... $xmlReader->read(); do { if ($xmlReader->nodeType == XMLReader::ELEMENT) { $elementName = mb_strtoupper($xmlReader->name); /* ... diese Node in Array umwandeln $node['USER']['__DATA'] = ''; $node['USER']['ID']['__ATTR']['ID'] = '101016'; $node['USER']['ID']['__DATA'] = 'B97CE517-4D74-B6CE-BED8-EF76662FB7EE'; $node['USER']['USERNAME']['__DATA'] = 'Team BMW-Biker'; $node['USER']['PMR']['__DATA'] = '0'; $node['USER']['DATECREATED']['__DATA'] = '2005-08-14 00:00:00'; $node['USER']['LASTMODIFIED']['__DATA'] = '2005-10-30 19:26:51'; */ unset($node); $node[$elementName]['__DATA'] = ''; $sSubElement = ''; $nRecursionLevel = 1; while ($xmlReader->read() && $nRecursionLevel > 0) { if ($xmlReader->nodeType == XMLReader::TEXT) { if ($sSubElement != '') { $node[$elementName][$sSubElement]['__DATA'] = $xmlReader->value; } else { $node[$elementName]['__DATA'] = $xmlReader->value; } } else { if ($xmlReader->nodeType == XMLReader::CDATA) { if ($sSubElement != '') { $node[$elementName][$sSubElement]['__DATA'] = $xmlReader->value; } else { $node[$elementName]['__DATA'] = $xmlReader->value; } } else { if ($xmlReader->nodeType == XMLReader::ELEMENT) { if ($sSubElement != '') { // vorheriges element zuerst schlißen $sSubElement = ''; $nRecursionLevel--; } $sSubElement = mb_strtoupper($xmlReader->name); $nRecursionLevel++; // attribute auslesen if ($xmlReader->moveToFirstAttribute()) { $node[$elementName][$sSubElement]['__ATTR'][mb_strtoupper($xmlReader->name)] = $xmlReader->value; while ($xmlReader->moveToNextAttribute()) { $node[$elementName][$sSubElement]['__ATTR'][mb_strtoupper($xmlReader->name)] = $xmlReader->value; } } } else { if ($xmlReader->nodeType == XMLReader::END_ELEMENT) { $sSubElement = ''; $nRecursionLevel--; } } } } } switch ($elementName) { case 'USER': ImportUserArray($node['USER']); break; case 'CACHE': ImportCacheArray($node['CACHE']); break; case 'CACHEDESC': ImportCacheDescArray($node['CACHEDESC']); break; case 'CACHELOG': ImportCachelogArray($node['CACHELOG']); break; case 'PICTURE': ImportPictureArray($node['PICTURE']); break; case 'REMOVEDOBJECT': ImportRemovedObjectArray($node['REMOVEDOBJECT']); break; default: echo 'Unknown Element "' . $xmlReader->name . '", skipping' . "\n"; break; } } } while ($xmlReader->read()); $xmlReader->close(); $xmlReader = null; // zeitstempel notieren $oldstarttime = strtotime(getSysConfig('ocxml11client_lastupdate', '2005-08-01 00:00:00')); if ($oldstarttime < $starttime) { setSysConfig('ocxml11client_lastupdate', date('Y-m-d H:i:s', $starttime)); } }
function export() { global $opt, $tpl, $translang; $structure = enumSqlFiles($opt['rootpath'] . "doc/sql/tables"); foreach ($structure as $sTable) { sql_export_structure_to_file($opt['rootpath'] . 'doc/sql/tables/' . $sTable . '.sql', $sTable); } // static data tables $stab[] = 'attribute_categories'; $stab[] = 'attribute_groups'; $stab[] = 'cache_attrib'; $stab[] = 'cache_logtype'; $stab[] = 'cache_report_reasons'; $stab[] = 'cache_report_status'; $stab[] = 'cache_size'; $stab[] = 'cache_status'; $stab[] = 'cache_type'; $stab[] = 'coordinates_type'; $stab[] = 'countries'; $stab[] = 'countries_list_default'; $stab[] = 'countries_options'; $stab[] = 'helppages'; $stab[] = 'languages'; $stab[] = 'languages_list_default'; $stab[] = 'logentries_types'; $stab[] = 'log_types'; $stab[] = 'news_topics'; $stab[] = 'nodes'; $stab[] = 'object_types'; $stab[] = 'profile_options'; $stab[] = 'replication_overwritetypes'; $stab[] = 'search_ignore'; $stab[] = 'statpics'; $stab[] = 'sys_menu'; $stab[] = 'sys_trans'; $stab[] = 'sys_trans_ref'; $stab[] = 'sys_trans_text'; $stab[] = 'towns'; $stab[] = 'watches_waitingtypes'; sql_export_tables_to_file($opt['rootpath'] . 'doc/sql/static-data/data.sql', $stab); $checksum = calcDataSqlChecksum(false); $f = fopen($opt['rootpath'] . 'doc/sql/static-data/data.sql', 'a'); fwrite($f, "INSERT INTO `sysconfig` (`name`, `value`) VALUES ('datasql_checksum', '" . sql_escape($checksum) . "') ON DUPLICATE KEY UPDATE `value`='" . sql_escape($checksum) . "';"); fclose($f); setSysConfig('datasql_checksum', $checksum); $tpl->redirect('translate.php?translang=' . $translang); }
static function parseLink($_path = "") { if ($_path == "") { if (isset($_SERVER['REDIRECT_URL'])) { $_path = $_SERVER['REDIRECT_URL']; } else { $path = $_SERVER['REQUEST_URI']; } } $_path = str_replace(".html", "", $_path); $YiiMenu = YiiMenu::getInstance(); $db = Yii::app()->db; $params = array(); $all_menu = $YiiMenu->getItems(); $app = Request::getVar('app', null); $menuID = Request::getVar('menuID', null); if ($app != null or $menuID != null) { $params = $_REQUEST; } else { $path = trim($_path, "/"); $arr_path = array($path); $paths = explode("/", $path); $length = count($paths); for ($i = $length - 1; $i > 0; $i--) { unset($paths[$i]); $arr_path[] = implode("/", $paths); } $_arr_path = array(); $found_menu = false; if (count($arr_path) > 0) { foreach ($arr_path as $path) { foreach ($all_menu as $key => $menu) { if ($path == trim($menu['path'], "/")) { $menuID = $key; $found_menu = true; break 2; } } } } if ($menuID == null) { $menuID = $YiiMenu->getActive(); } $item = $YiiMenu->getItem($menuID); $app_router = null; if ($found_menu == true) { $url1 = trim($item['url'], "/"); $url2 = trim($_path, "/"); if ($url1 !== $url2) { $_app = $item['params']->app; $app_router = PATH_APPS_FRONT . "{$_app}/router.php"; $sub_path = preg_replace("|{$url1}|ism", "", $url2, 1); $params = $item['params']; } } else { if (preg_match("/app\\/([\\d\\w]+)(\\/*.*?)\$/", $_path, $matches)) { $_app = $matches[1]; //$app_router = PATH_APPS_FRONT."$_app/router.php"; $sub_path = ltrim($matches[2], "/"); $sub_path = explode("/", $sub_path); $params = array(); $params['app'] = $_app; if (count($sub_path) == 2 and trim($sub_path[1] != "")) { // app/app-name/view-name/layout-name $params['view'] = $sub_path[0]; $params['layout'] = $sub_path[1]; } else { if (is_array($sub_path)) { // app/app-name/layout-name $params['view'] = $sub_path[0]; // $params['layout'] = 'display'; } } foreach ($_REQUEST as $k => $v) { $params[$k] = $v; } } } if ($app_router != null) { $sub_path = trim($sub_path, "/"); $segments = explode("/", $sub_path); $functionName = $_app . "ParseRoute"; if (file_exists($app_router)) { require_once $app_router; } if (function_exists($functionName)) { $params = $functionName($segments, $params); } $params['app'] = $_app; } else { if ($item['params'] != null) { foreach ($item['params'] as $key => $value) { if (!isset($params[$key]) or empty($params[$key])) { $params[$key] = $value; } } } } } if (!isset($params['view']) or empty($params['view'])) { $params['view'] = 'home'; } if (!isset($params['layout']) or empty($params['layout'])) { $params['layout'] = 'display'; } $params['menuID'] = $menuID; setSysConfig("sys.menuID", $menuID); foreach ($params as $key => $value) { $_GET[$key] = $value; $_REQUEST[$key] = $value; $_POST[$key] = $value; } if (!isset($params['layout']) or $params['layout'] == "") { $params['layout'] = "display"; } return $params; }
define("ENABLE_SSO", 0); define("ROOT_PATH", dirname(dirname(__FILE__)) . "/"); define("PATH_TMP", ROOT_PATH . "tmp/"); define('PATH_APIFILE', ROOT_PATH . "tmp/apifile/"); define('PATH_APPS', dirname(__FILE__) . "/apps/"); define('PATH_MODULES', dirname(__FILE__) . "/extensions/modules/"); define('PATH_APPS_BACKEND', dirname(__FILE__) . "/apps/backend/"); define('PATH_APPS_FRONT', dirname(__FILE__) . "/apps/frontend/"); $os = strtoupper(substr(PHP_OS, 0, 3)); if (!defined('IS_WIN')) { define('IS_WIN', $os === 'WIN' ? true : false); } if (!defined('IS_UNIX')) { define('IS_UNIX', IS_WIN === false ? true : false); } global $sys_config, $sys_menu; $sys_menu = $sys_config = array(); setSysConfig("colright.display", true); setSysConfig("page.classSuffix", ""); setSysConfig("news.detail.showpath", 1); setSysConfig("news.limit", 10); setSysConfig("pages.limit", 15); setSysConfig("seopage.title", "seo page title"); setSysConfig("seopage.keyword", "seo page keyword"); setSysConfig("seopage.description", "seo page description"); /* * controll: 0 * action: 1 * page-tpl: 2 * layout: 3 * */
die; } $params = Router::parseLink(); global $pagetype, $cur_temp; $debug = isset($_REQUEST['debug']) ? $_REQUEST['debug'] : 0; $pagetype = 1; if ($debug == 0) { $pagetype = 1; } else { $pagetype = 2; } if (isset($params['app']) and isset($params['view']) and $pagetype == 1) { $cur_temp = "wapsite"; setSysConfig("sys.template", $cur_temp); setSysConfig("sys.template.path", ROOT_PATH . "themes/{$cur_temp}/"); setSysConfig("sys.template.url", "/themes/{$cur_temp}/"); // thu tu uu tien: theme/$template => protected/apps/frontend/$app/views => /protected/views/frontend if (isset($params['app'])) { $yiiapp->setControllerPath(ROOT_PATH . 'protected/apps/frontend/' . $params['app'] . '/controllers/'); if (is_dir(ROOT_PATH . "themes/{$cur_temp}")) { $yiiapp->setViewPath(ROOT_PATH . "themes/{$cur_temp}"); } else { $yiiapp->setViewPath(ROOT_PATH . 'protected/apps/frontend/' . $params['app'] . '/views/'); } } else { $yiiapp->setControllerPath(ROOT_PATH . 'protected/controllers/frontend'); $yiiapp->setViewPath(ROOT_PATH . 'protected/views/frontend'); } // $rt = $params['controller'] . "/".$params['action']; if (!isset($params['layout'])) { $params['layout'] = "display";