/** * */ public function saveComposition($content, $product_array_streams, $studio_id, $design_array_streams = array(), $design_data = array()) { try { $response = array(); $xml = @simplexml_load_string($content); if (!is_object($xml)) { return array("ERROR" => "Error reading XML"); } else { if (isset($this->session->data["user_id"]) || isset($this->session->data["customer_id"])) { if (isset($this->session->data["user_id"])) { $id_author = 0; } else { $id_author = $this->session->data["customer_id"]; } $idea = new DesignIdea($this->db); $data["product_id"] = $xml["id_product"]; $data["id_product_color"] = $xml["id_product_color"]; $data["name"] = utf8_encode($xml["name"]); $data["id_author"] = $id_author; if (!empty($xml["id_composition"]) && $idea->compositionExists($xml["id_composition"])) { $data["id_composition"] = (string) $xml["id_composition"]; } $idea->setFieldsData($data); $i = 0; foreach ($xml->design as $design_node) { $designObj = new Design($this->db); $designObj->setXML(utf8_encode($design_node->asXML())); $designObj->setSnapshot($product_array_streams[$i]); if (isset($design_array_streams[$i])) { $designObj->setOnlyDesignSnapshot($design_array_streams[$i]); } if (isset($design_data[$i])) { $designObj->setNumColors($design_data[$i]->num_colors); $designObj->setNeedWhiteBase($design_data[$i]->need_white_base); } foreach ($design_node->design_element as $design_element_node) { $design_element = new DesignElement($this->db); $design_element->setDesignElement($design_element_node['id']); $design_element->setType($design_element_node['type']); $designObj->addDesignElement($design_element); } $idea->addDesign($designObj); $i++; } if ($id_comp = $idea->save()) { $this->session->data['studio_data'][$studio_id]['id_composition'] = $id_comp; return array("id_composition" => $id_comp); //everything ok! } else { return array("ERROR" => "error saving composition " . $idea->last_error); } } else { return array("ERROR" => "User not logged in "); } } } catch (Exception $e) { return array("ERROR" => (string) $e); } }
public static function show($console, $result, $data) { $text = ''; if (!$console) { $text .= Design::erstelleBeschreibung($console, Language::Get('generateComponents', 'description')); } if (isset($result[self::$onEvents['install']['name']]) && $result[self::$onEvents['install']['name']] != null) { $result = $result[self::$onEvents['install']['name']]; } else { $result = array('content' => null, 'fail' => false, 'errno' => null, 'error' => null); } $fail = $result['fail']; $error = $result['error']; $errno = $result['errno']; $content = $result['content']; if (!$console) { $text .= Design::erstelleZeile($console, Language::Get('generateComponents', 'generateComponents'), 'e', '', 'v', Design::erstelleSubmitButton(self::$onEvents['install']['event'][0]), 'h'); } if (self::$installed) { if (isset($content['components'])) { $text .= Design::erstelleZeile($console, Language::Get('generateComponents', 'numberComponents'), 'v', $content['componentsCount'], 'v'); $text .= Design::erstelleZeile($console, Language::Get('generateComponents', 'numberLinks'), 'v', $content['linksCount'], 'v'); } $text .= Design::erstelleInstallationszeile($console, $fail, $errno, $error); } echo Design::erstelleBlock($console, Language::Get('generateComponents', 'title'), $text); return null; }
public static function show($console, $result, $data) { $text = ''; $text .= Design::erstelleBeschreibung($console, Language::Get('createSuperAdmin', 'description')); if (!$console) { $text .= Design::erstelleZeile($console, Language::Get('createSuperAdmin', 'db_user_insert'), 'e', Design::erstelleEingabezeile($console, $data['DB']['db_user_insert'], 'data[DB][db_user_insert]', 'root'), 'v'); $text .= Design::erstelleZeile($console, Language::Get('createSuperAdmin', 'db_passwd_insert'), 'e', Design::erstellePasswortzeile($console, $data['DB']['db_passwd_insert'], 'data[DB][db_passwd_insert]', ''), 'v'); $text .= Design::erstelleZeile($console, Language::Get('createSuperAdmin', 'db_first_name_insert'), 'e', Design::erstelleEingabezeile($console, $data['DB']['db_first_name_insert'], 'data[DB][db_first_name_insert]', ''), 'v'); $text .= Design::erstelleZeile($console, Language::Get('createSuperAdmin', 'db_last_name_insert'), 'e', Design::erstelleEingabezeile($console, $data['DB']['db_last_name_insert'], 'data[DB][db_last_name_insert]', ''), 'v'); $text .= Design::erstelleZeile($console, Language::Get('createSuperAdmin', 'db_email_insert'), 'e', Design::erstelleEingabezeile($console, $data['DB']['db_email_insert'], 'data[DB][db_email_insert]', ''), 'v', Design::erstelleSubmitButton(self::$onEvents['install']['event'][0], Language::Get('main', 'create')), 'h'); } if (isset($result[self::$onEvents['install']['name']]) && $result[self::$onEvents['install']['name']] != null) { $result = $result[self::$onEvents['install']['name']]; } else { $result = array('content' => null, 'fail' => false, 'errno' => null, 'error' => null); } $fail = $result['fail']; $error = $result['error']; $errno = $result['errno']; $content = $result['content']; if (self::$installed) { $text .= Design::erstelleInstallationszeile($console, $fail, $errno, $error); } echo Design::erstelleBlock($console, Language::Get('createSuperAdmin', 'title'), $text); }
public static function show($console, $result, $data) { $isUpdate = isset($data['action']) && $data['action'] == 'update' ? true : false; $text = ''; $text .= Design::erstelleBeschreibung($console, Language::Get('platform', 'description')); if (!$console) { $text .= Design::erstelleZeile($console, Language::Get('platform', 'createTables'), 'e', '', 'v', Design::erstelleSubmitButton(self::$onEvents['install']['event'][0]), 'h'); $text .= Design::erstelleZeile($console, Language::Get('platform', 'details'), 'e', Design::erstelleAuswahl($console, $data['PL']['pl_details'], 'data[PL][pl_details]', 'details', null), 'v'); } if (isset($result[self::$onEvents['install']['name']]) && $result[self::$onEvents['install']['name']] != null) { $result = $result[self::$onEvents['install']['name']]; } else { $result = array('content' => null, 'fail' => false, 'errno' => null, 'error' => null); } $fail = $result['fail']; $error = $result['error']; $errno = $result['errno']; $content = $result['content']; if (self::$installed) { if (!$console && isset($data['PL']['pl_details']) && $data['PL']['pl_details'] === 'details' && !$isUpdate) { foreach ($content as $component => $dat) { $text .= "<tr><td class='e' rowspan='1'>{$component}</td><td class='v'></td><td class='e'><div align ='center'>" . (isset($dat['status']) && $dat['status'] === 201 ? Language::Get('main', 'ok') : "<font color='red'>" . Language::Get('main', 'fail') . " ({$dat['status']})</font>") . "</align></td></tr>"; } } else { $text .= Design::erstelleZeile($console, Language::Get('platform', 'countComponents'), 'e', count($content), 'v_c'); } $text .= Design::erstelleInstallationszeile($console, $fail, $errno, $error); } echo Design::erstelleBlock($console, Language::Get('platform', 'title'), $text); return null; }
function showCSS($out) { $css = ''; $bgcolor = Design::toWebColor($this->backgroundcolor); if (!empty($bgcolor)) { $css .= 'body { background-color: #' . $bgcolor->hexValue() . ' }' . "\n"; } $ccolor = Design::toWebColor($this->contentcolor); if (!empty($ccolor)) { $css .= '#content, #site_nav_local_views .current a { background-color: #'; $css .= $ccolor->hexValue() . '} ' . "\n"; } $sbcolor = Design::toWebColor($this->sidebarcolor); if (!empty($sbcolor)) { $css .= '#aside_primary { background-color: #' . $sbcolor->hexValue() . ' }' . "\n"; } $tcolor = Design::toWebColor($this->textcolor); if (!empty($tcolor)) { $css .= 'html body { color: #' . $tcolor->hexValue() . ' }' . "\n"; } $lcolor = Design::toWebColor($this->linkcolor); if (!empty($lcolor)) { $css .= 'a { color: #' . $lcolor->hexValue() . ' }' . "\n"; } if (!empty($this->backgroundimage) && $this->disposition & BACKGROUND_ON) { $repeat = $this->disposition & BACKGROUND_TILE ? 'background-repeat:repeat;' : 'background-repeat:no-repeat;'; $css .= 'body { background-image:url(' . Design::url($this->backgroundimage) . '); ' . $repeat . ' background-attachment:fixed; }' . "\n"; } if (0 != mb_strlen($css)) { $out->style($css); } }
public function action_index() { $breadcrumb = 'menu_navigation_production_applis'; $elements = ORM::factory('syntaxchecker_project')->order_by('namespace')->order_by('title')->find_all()->as_array('id'); $view = View::factory($this->request->controller() . '/' . $this->request->action(), array('elements' => $elements)); Design::instance()->set_title(__($breadcrumb))->set_breadcrumb('index', __($breadcrumb), Route::get('default')->uri(array('controller' => 'applis', 'action' => 'index')))->set_content('index', $view); }
function run() { global $Templates, $DB, $Controller; $_REQUEST->setType('item', 'numeric'); $PERPAGE = 5; if ($_REQUEST['item']) { $obj = $Controller->{$_REQUEST['item']}; $content = $obj->display(false, true, true, true); } else { $QUEUE = $this->ID; $COUNT = (int) $DB->flow->count(array('queue~' => $QUEUE), 'id'); $pagination = Pagination::getRange($PERPAGE, $COUNT); $Objects = Flow::retrieve('News', $PERPAGE, false, false, false, $pagination['range']['start']); $content = ''; $first = true; foreach ($Objects as $obj) { $content .= '<li' . ($first ? '' : ' class="cols"') . '>' . $obj->display(false, $first, true) . '</li>'; $first = false; } $content = '<ul>' . $content . '</ul>' . $pagination['links']; } $r = '<h1>FlowView</h1>' . Design::row(array(Design::column('<div class="padded">' . $content . '</div>', 8, true, true, true), Design::column('Möjlighet att följa nyheterna via RSS kommer... ', 4, false, true, true)), true); $this->setContent('main', $r); $this->setContent('menu', $this->submenu()); $Templates->yweb('empty')->render(); }
public static function show($console, $result, $data) { $text = ''; if (!$console) { $text .= Design::erstelleBeschreibung($console, Language::Get('general_settings', 'description')); $text .= Design::erstelleZeile($console, Language::Get('general_settings', 'init'), 'e', '', 'v', Design::erstelleSubmitButton('actionInstallInit'), 'h'); $text .= Design::erstelleZeile($console, Language::Get('database', 'db_override'), 'e', Design::erstelleAuswahl($console, $data['DB']['db_override'], 'data[DB][db_override]', 'override', null, true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('database', 'db_ignore'), 'e', Design::erstelleAuswahl($console, $data['DB']['db_ignore'], 'data[DB][db_ignore]', 'ignore', null, true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('general_settings', 'details'), 'e', Design::erstelleAuswahl($console, $data['PL']['pl_main_details'], 'data[PL][pl_main_details]', 'details', null, true), 'v'); } if (isset($result[self::$onEvents['install']['name']]) && $result[self::$onEvents['install']['name']] != null) { $result = $result[self::$onEvents['install']['name']]; } else { $result = array('content' => null, 'fail' => false, 'errno' => null, 'error' => null); } $fail = $result['fail']; $error = $result['error']; $errno = $result['errno']; $content = $result['content']; if (self::$installed) { if ($data['PL']['pl_main_details'] == 'details') { foreach ($content as $component => $dat) { if (!$console) { $text .= "<tr><td class='e' rowspan='1'>{$component}</td><td class='v'></td><td class='e'><div align ='center'>" . (isset($dat['status']) && $dat['status'] === 201 ? Language::Get('main', 'ok') : "<font color='red'>" . Language::Get('main', 'fail') . " ({$dat['status']})</font>") . "</align></td></tr>"; } else { $text .= "{$component}: " . (isset($dat['status']) && $dat['status'] === 201 ? Language::Get('main', 'ok') . "\n" : Language::Get('main', 'fail') . " ({$dat['status']})\n"); } } } $text .= Design::erstelleInstallationszeile($console, $fail, $errno, $error); } echo Design::erstelleBlock($console, Language::Get('general_settings', 'title'), $text); return null; }
public static function show($console, $result, $data) { $text = ''; $text .= Design::erstelleBeschreibung($console, Language::Get('extensions', 'description')); if (isset($result[self::$onEvents['check']['name']]) && $result[self::$onEvents['check']['name']] != null) { $result = $result[self::$onEvents['check']['name']]; } else { $result = array('content' => null, 'fail' => false, 'errno' => null, 'error' => null); } $fail = $result['fail']; $error = $result['error']; $errno = $result['errno']; $content = $result['content']; if ($content != null) { foreach ($content as $extensionName => $status) { if (!$console) { $text .= Design::erstelleZeile($console, $extensionName, 'e', $status ? Language::Get('main', 'ok') : "<font color='red'>" . Language::Get('main', 'fail') . "</font>", 'v'); } else { $text .= $extensionName . ' ' . ($status ? Language::Get('main', 'ok') : Language::Get('main', 'fail')) . "\n"; } } } else { $text .= Design::erstelleZeile($console, "<font color='red'>" . Language::Get('main', 'fail') . "</font>", 'e'); } echo Design::erstelleBlock($console, Language::Get('extensions', 'title'), $text); return null; }
public static function show($console, $result, $data) { $text = ''; if (!$console) { $text .= Design::erstelleBeschreibung($console, Language::Get('database_informations', 'description')); $text .= Design::erstelleZeile($console, Language::Get('database_informations', 'db_path'), 'e', Design::erstelleEingabezeile($console, $data['DB']['db_path'], 'data[DB][db_path]', 'localhost', true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('database_informations', 'db_name'), 'e', Design::erstelleEingabezeile($console, $data['DB']['db_name'], 'data[DB][db_name]', 'uebungsplattform', true), 'v'); echo Design::erstelleBlock($console, Language::Get('database_informations', 'title'), $text); } $text = ''; if (!$console) { $text .= "<tr><td colspan='2'>" . Language::Get('databaseAdmin', 'description') . "</td></tr>"; $text .= Design::erstelleZeile($console, Language::Get('databaseAdmin', 'db_user'), 'e', Design::erstelleEingabezeile($console, $data['DB']['db_user'], 'data[DB][db_user]', 'root', true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('databaseAdmin', 'db_passwd'), 'e', Design::erstellePasswortzeile($console, $data['DB']['db_passwd'], 'data[DB][db_passwd]', '', true), 'v'); echo Design::erstelleBlock($console, Language::Get('databaseAdmin', 'title'), $text); } $text = ''; if (!$console) { $text .= "<tr><td colspan='2'>" . Language::Get('databasePlatformUser', 'description') . "</td></tr>"; $text .= Design::erstelleZeile($console, Language::Get('databasePlatformUser', 'db_user_operator'), 'e', Design::erstelleEingabezeile($console, $data['DB']['db_user_operator'], 'data[DB][db_user_operator]', 'DBOperator', true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('databasePlatformUser', 'db_passwd_operator'), 'e', Design::erstellePasswortzeile($console, $data['DB']['db_passwd_operator'], 'data[DB][db_passwd_operator]', '', true), 'v'); echo Design::erstelleBlock($console, Language::Get('databasePlatformUser', 'title'), $text); } return null; }
public static function showInfoBar(&$data) { if (Einstellungen::$accessAllowed) { // Aktionen echo "<tr><td class='e'>" . Language::Get('main', 'actions') . "</td></tr>"; // update-Button echo "<tr><td class='v'>" . Design::erstelleSubmitButtonFlach('update', 'OK', Language::Get('main', 'simpleUpdate') . ">") . "</td></tr>"; } }
public static function init($console, &$data, &$fail, &$errno, &$error) { foreach (Einstellungen::$masterPassword as $key => $tm) { if (trim($tm) != '') { echo Design::erstelleVersteckteEingabezeile($console, $tm, 'tmp[' . $key . '][oldMasterPassword]', '', false); } } self::$initialized = true; }
public function index() { $countHousesByCities = $this->houseModel->countHousesByCities(); $numberHousesSell = $this->houseModel->getCountHousesSell(); $numberHousesRent = $this->houseModel->getCountHousesRent(); $numberProjects = $this->projectModel->getCountProjects(); $numberDesigns = $this->designModel->getCountDesigns(); $numberResources = $numberHousesSell + $numberHousesRent + $numberProjects + $numberDesigns; $ratioHousesSell = \Kan\Core\Num::ratio($numberHousesSell, $numberResources); $ratioHousesRent = \Kan\Core\Num::ratio($numberHousesRent, $numberResources); $ratioProjects = \Kan\Core\Num::ratio($numberProjects, $numberResources); $ratioDesigns = \Kan\Core\Num::ratio($numberDesigns, $numberResources); $countCitiesByQuantityAndHousesSell = $this->houseModel->getCountCitiesByQuantityAndHousesSell(); $countCitiesByQuantityAndHousesRent = $this->houseModel->getCountCitiesByQuantityAndHousesRent(); $countCitiesByQuantityAndProjects = $this->projectModel->getCountCitiesByQuantityAndProjects(); $countCitiesByQuantityAndDesigns = $this->designModel->getCountCitiesByQuantityAndDesigns(); return view('charts.index')->with('countHousesByCities', json_encode($countHousesByCities))->with('countResourcesByQuantity', json_encode([$numberHousesSell, $numberHousesRent, $numberProjects, $numberDesigns]))->with('ratioResourceByQuantity', json_encode([$ratioHousesSell, $ratioHousesRent, $ratioProjects, $ratioDesigns]))->with('countCitiesByQuantityAndHousesSell', json_encode($countCitiesByQuantityAndHousesSell))->with('countCitiesByQuantityAndHousesRent', json_encode($countCitiesByQuantityAndHousesRent))->with('countCitiesByQuantityAndProjects', json_encode($countCitiesByQuantityAndProjects))->with('countCitiesByQuantityAndDesigns', json_encode($countCitiesByQuantityAndDesigns)); }
function install() { global $Controller, $DB, $CONFIG; $Controller->newObj('PageLayoutEditor')->move('last', 'adminMenu'); $DB->query("CREATE TABLE IF NOT EXISTS `pagelayout` (\n `pid` int(11) NOT NULL,\n `id` int(11) NOT NULL,\n `module` varchar(255) collate utf8_swedish_ci NOT NULL,\n `type` varchar(11) collate utf8_swedish_ci NOT NULL,\n `row` int(11) NOT NULL,\n `place` int(11) NOT NULL,\n `size` int(11) NOT NULL,\n `content` text collate utf8_swedish_ci NOT NULL,\n KEY `row` (`row`),\n KEY `id` (`id`),\n KEY `pid` (`pid`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci;"); Design::registerModule('news', 'News', 'large/agt_announcements-32', array(3, 6, 12), array('autofill', 'id'), array('Page'), false); Design::registerModule('html', 'HTML', 'large/contents-32', array(2, 3, 4, 5, 6, 7, 8, 10, 12), array('text'), array('Page'), false); Design::registerModule('image', 'Image', 'large/thumbnail-32', array(2, 3, 4, 5, 6, 7, 8, 10, 12), array('image'), array('Page'), false); return self::$VERSION; }
public static function showInfoBar(&$data) { echo "<tr><td class='e'>" . Language::Get('main', 'serverList') . "</td></tr>"; foreach (Einstellungen::$serverFiles as $serverFile) { $file = pathinfo($serverFile)['filename']; echo "<tr><td class='v'>" . Design::erstelleSubmitButtonFlach('server', $file, Einstellungen::$selected_server == $file ? '<font color="maroon">' . $file . '</font>' : $file) . "</td></tr>"; } if (Einstellungen::$accessAllowed) { echo "<tr><td class='v'>" . Design::erstelleSubmitButtonFlach('actionAddServer', 'OK', Language::Get('main', 'addServer') . ">") . "</td></tr>"; } echo Design::erstelleVersteckteEingabezeile(false, Einstellungen::$selected_server, 'selected_server', null); }
public static function show($console, $result, $data) { $text = ''; $failure = false; Einstellungen::$path = dirname(__FILE__) . '/../config'; if (!is_dir(Einstellungen::$path) || !is_writable(__FILE__)) { $text .= Design::erstelleZeile($console, Language::Get('mainInfo', 'notWritable'), 'error'); $failure = true; } if ($failure) { echo Design::erstelleBlock($console, Language::Get('mainInfo', 'title'), $text); } }
public static function show($console, $result, $data) { $text = ''; $text .= Design::erstelleBeschreibung($console, Language::Get('general_informations', 'description')); if (!$console) { $text .= Design::erstelleZeile($console, Language::Get('general_informations', 'server_name'), 'e', Design::erstelleEingabezeile($console, $data['SV']['name'], 'data[SV][name]', $data['SV']['name'], false), 'v'); $text .= Design::erstelleZeile($console, Language::Get('general_informations', 'url'), 'e', Design::erstelleEingabezeile($console, $data['PL']['url'], 'data[PL][url]', 'http://localhost/uebungsplattform', true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('general_informations', 'localPath'), 'e', Design::erstelleEingabezeile($console, $data['PL']['localPath'], 'data[PL][localPath]', '/var/www/uebungsplattform', true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('general_informations', 'urlExtern'), 'e', Design::erstelleEingabezeile($console, $data['PL']['urlExtern'], 'data[PL][urlExtern]', 'http://localhost/uebungsplattform', true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('general_informations', 'temp'), 'e', Design::erstelleEingabezeile($console, $data['PL']['temp'], 'data[PL][temp]', '/var/www/temp', true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('general_informations', 'files'), 'e', Design::erstelleEingabezeile($console, $data['PL']['files'], 'data[PL][files]', '/var/www/files', true), 'v'); } echo Design::erstelleBlock($console, Language::Get('general_informations', 'title'), $text); return null; }
public static function show($console, $result, $data) { $text = ''; if (!$console) { $text .= Design::erstelleBeschreibung($console, Language::Get('access', 'description')); $text .= Design::erstelleZeile($console, Language::Get('access', 'local'), 'e', Design::erstelleGruppenAuswahl($console, $data['ZV']['zv_type'], 'data[ZV][zv_type]', 'local', 'local', true), 'v'); $text .= Design::erstelleZeile($console, ' ', '', '', ''); $text .= Design::erstelleZeile($console, Language::Get('access', 'ssh'), 'e', Design::erstelleGruppenAuswahl($console, $data['ZV']['zv_type'], 'data[ZV][zv_type]', 'ssh', null, true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('access', 'username'), 'e', Design::erstelleEingabezeile($console, $data['ZV']['zv_ssh_login'], 'data[ZV][zv_ssh_login]', 'root'), 'v'); $text .= Design::erstelleZeile($console, Language::Get('access', 'address'), 'e', Design::erstelleEingabezeile($console, $data['ZV']['zv_ssh_address'], 'data[ZV][zv_ssh_address]', 'localhost'), 'v'); $text .= Design::erstelleZeile($console, Language::Get('access', 'password'), 'e', Design::erstellePasswortzeile($console, $data['ZV']['zv_ssh_password'], 'data[ZV][zv_ssh_password]', ''), 'v', Design::erstelleGruppenAuswahl($console, $data['ZV']['zv_ssh_auth_type'], 'data[ZV][zv_ssh_auth_type]', 'passwd', 'passwd', true), 'h'); $text .= Design::erstelleZeile($console, Language::Get('access', 'keyFile'), 'e', Design::erstelleEingabezeile($console, $data['ZV']['zv_ssh_key_file'], 'data[ZV][zv_ssh_key_file]', '/var/public.ppk'), 'v', Design::erstelleGruppenAuswahl($console, $data['ZV']['zv_ssh_auth_type'], 'data[ZV][zv_ssh_auth_type]', 'keyFile', null, true), 'h'); echo Design::erstelleBlock($console, Language::Get('access', 'title'), $text); } return null; }
public static function show($console, $result, $data) { $executedEvents = array(); foreach ($result as $key => $value) { $executedEvents[] = $key; } $text = ''; $text .= Design::erstelleBeschreibung($console, Language::Get('cleanCourses', 'description')); if (!$console) { $text .= Design::erstelleZeile($console, Language::Get('cleanCourses', 'getAmount'), 'e', '', 'v', Design::erstelleSubmitButton(self::$onEvents['collectCleanCourses']['event'][0], Language::Get('cleanCourses', 'collectAmount')), 'h'); } if (isset($result[self::$onEvents['collectCleanCourses']['name']]) && $result[self::$onEvents['collectCleanCourses']['name']] != null) { $result = $result[self::$onEvents['collectCleanCourses']['name']]; } else { $result = array('content' => null, 'fail' => false, 'errno' => null, 'error' => null); } $fail = $result['fail']; $error = $result['error']; $errno = $result['errno']; $content = $result['content']; if (self::$installed) { if (!$console && isset($data['C']['c_details']) && $data['C']['c_details'] === 'details') { if (isset($content)) { foreach ($content as $component => $dat) { $text .= "<tr><td class='e' rowspan='1'>{$component}</td><td class='v'><div align ='center'>{$dat['amount']}</align></td></tr>"; } } } else { $count = 0; if (isset($content)) { foreach ($content as $component => $dat) { $count += $dat['amount']; } } $text .= Design::erstelleZeile($console, Language::Get('cleanCourses', 'dirtyRows'), 'e', $count, 'v_c'); } if (!$console && in_array(self::$onEvents['collectCleanCourses']['name'], $executedEvents)) { $text .= Design::erstelleZeile($console, Language::Get('cleanCourses', 'cleanCourses'), 'e', '', 'v', Design::erstelleSubmitButton(self::$onEvents['cleanCourses']['event'][0], Language::Get('cleanCourses', 'clean')), 'h'); } elseif (!$console && in_array(self::$onEvents['cleanCourses']['name'], $executedEvents)) { $text .= Design::erstelleInstallationszeile($console, $fail, $errno, $error); } } echo Design::erstelleBlock($console, Language::Get('cleanCourses', 'title'), $text); return null; }
public static function show($console, $result, $data) { $text = ''; $text .= Design::erstelleBeschreibung($console, Language::Get('userInterface', 'description')); if (!$console) { $text .= Design::erstelleZeile($console, Language::Get('userInterface', 'conf'), 'e', Design::erstelleEingabezeile($console, $data['UI']['conf'], 'data[UI][conf]', '../UI/include/Config.php', true), 'v', Design::erstelleSubmitButton(self::$onEvents['install']['event'][0]), 'h'); $text .= Design::erstelleZeile($console, Language::Get('userInterface', 'siteKey'), 'e', Design::erstelleEingabezeile($console, $data['UI']['siteKey'], 'data[UI][siteKey]', 'b67dc54e7d03a9afcd16915a55edbad2d20a954562c482de3863456f01a0dee4', true), 'v'); } if (isset($result[self::$onEvents['install']['name']]) && $result[self::$onEvents['install']['name']] != null) { $result = $result[self::$onEvents['install']['name']]; } else { $result = array('content' => null, 'fail' => false, 'errno' => null, 'error' => null); } $fail = $result['fail']; $error = $result['error']; $errno = $result['errno']; $content = $result['content']; if (self::$installed) { $text .= Design::erstelleInstallationszeile($console, $fail, $errno, $error); } echo Design::erstelleBlock($console, Language::Get('userInterface', 'title'), $text); }
public static function show($console, $result, $data) { $text = ''; if (!$console) { $text .= Design::erstelleBeschreibung($console, Language::Get('createDatabasePlatformUser', 'description')); $text .= Design::erstelleZeile($console, Language::Get('createDatabasePlatformUser', 'db_user_override_operator'), 'e', Design::erstelleAuswahl($console, $data['DB']['db_user_override_operator'], 'data[DB][db_user_override_operator]', 'override', null, true), 'v'); $text .= Design::erstelleZeile($console, Language::Get('createDatabasePlatformUser', 'createUser'), 'e', '', 'v', Design::erstelleSubmitButton(self::$onEvents['install']['event'][0], Language::Get('main', 'create')), 'h'); } if (isset($result[self::$onEvents['install']['name']]) && $result[self::$onEvents['install']['name']] != null) { $result = $result[self::$onEvents['install']['name']]; } else { $result = array('content' => null, 'fail' => false, 'errno' => null, 'error' => null); } $fail = $result['fail']; $error = $result['error']; $errno = $result['errno']; $content = $result['content']; if (self::$installed) { $text .= Design::erstelleInstallationszeile($console, $fail, $errno, $error); } echo Design::erstelleBlock($console, Language::Get('createDatabasePlatformUser', 'title'), $text); return null; }
function getDesign() { return Design::staticGet('id', $this->design_id); }
/** * A design for this action * * @return Design a design object to use */ function getDesign() { return Design::siteDesign(); }
// upload management require_once "./lib/Search.php"; // search management require_once "./lib/Design.php"; // html output require_once "./lib/Tags.php"; // tag management if (isset($_GET['debug'])) { echo "Debug mode on!"; error_reporting(E_ALL); } else { error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE); } $inc = new Upload(); $inc->listen(); $site = new Design(); $tags = new Tags(); ?> <?php $site->header(); ?> <body> <div id="dialog"> <div class='content'></div> </div> <div id="menu"><h2>iZwei</h2> <?php echo $site->form(FORM_SIMPLESEARCH);
/** * Handle the request * * Check whether the credentials are valid and output the result * * @param array $args $_REQUEST data (unused) * * @return void */ function handle($args) { parent::handle($args); if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError(_('This method requires a POST.'), 400, $this->format); return; } if (!in_array($this->format, array('xml', 'json'))) { $this->clientError(_('API method not found.'), 404, $this->format); return; } // Workaround for PHP returning empty $_POST and $_FILES when POST // length > post_max_size in php.ini if (empty($_FILES) && empty($_POST) && $_SERVER['CONTENT_LENGTH'] > 0) { // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit. // TRANS: %s is the number of bytes of the CONTENT_LENGTH. $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.', 'The server was unable to handle that much POST data (%s bytes) due to its current configuration.', intval($_SERVER['CONTENT_LENGTH'])); $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH'])); return; } if (empty($this->user)) { // TRANS: Client error when user not found updating a profile background image. $this->clientError(_('No such user.'), 404, $this->format); return; } $design = $this->user->getDesign(); // XXX: This is kinda gross, but before we can add a background // img we have to make sure there's a Design because design ID // is part of the img filename. if (empty($design)) { $this->user->query('BEGIN'); // save new design $design = new Design(); $id = $design->insert(); if (empty($id)) { common_log_db_error($id, 'INSERT', __FILE__); // TRANS: Client error displayed when saving design settings fails because of an empty id. $this->clientError(_('Unable to save your design settings.')); return; } $original = clone $this->user; $this->user->design_id = $id; $result = $this->user->update($original); if (empty($result)) { common_log_db_error($original, 'UPDATE', __FILE__); // TRANS: Client error displayed when saving design settings fails because of an empty result. $this->clientError(_('Unable to save your design settings.')); $this->user->query('ROLLBACK'); return; } $this->user->query('COMMIT'); } // Okay, now get the image and add it to the design try { $imagefile = ImageFile::fromUpload('image'); } catch (Exception $e) { $this->clientError($e->getMessage(), 400, $this->format); return; } $filename = Design::filename($design->id, image_type_to_extension($imagefile->type), common_timestamp()); $filepath = Design::path($filename); move_uploaded_file($imagefile->filepath, $filepath); // delete any old backround img laying around if (isset($design->backgroundimage)) { @unlink(Design::path($design->backgroundimage)); } $original = clone $design; $design->backgroundimage = $filename; $design->setDisposition(true, false, $this->tile == 'true'); $result = $design->update($original); if ($result === false) { common_log_db_error($design, 'UPDATE', __FILE__); // TRANS: Error displayed when updating design settings fails. $this->showForm(_('Could not update your design.')); return; } $profile = $this->user->getProfile(); if (empty($profile)) { // TRANS: Client error displayed when a user has no profile. $this->clientError(_('User has no profile.')); return; } $twitter_user = $this->twitterUserArray($profile, true); if ($this->format == 'xml') { $this->initDocument('xml'); $this->showTwitterXmlUser($twitter_user, 'user', true); $this->endDocument('xml'); } elseif ($this->format == 'json') { $this->initDocument('json'); $this->showJsonObjects($twitter_user); $this->endDocument('json'); } }
/** * Save the background image, if any, and set its disposition * * @param Design $design a working design to attach the img to * * @return nothing */ function saveBackgroundImage($design) { // Now that we have a Design ID we can add a file to the design. // XXX: This is an additional DB hit, but figured having the image // associated with the Design rather than the User was worth // it. -- Zach if ($_FILES['design_background-image_file']['error'] == UPLOAD_ERR_OK) { $filepath = null; try { $imagefile = ImageFile::fromUpload('design_background-image_file'); } catch (Exception $e) { $this->showForm($e->getMessage()); return; } $filename = Design::filename($design->id, image_type_to_extension($imagefile->type), common_timestamp()); $filepath = Design::path($filename); move_uploaded_file($imagefile->filepath, $filepath); // delete any old backround img laying around if (isset($design->backgroundimage)) { @unlink(Design::path($design->backgroundimage)); } $original = clone $design; $design->backgroundimage = $filename; // default to on, no tile $design->setDisposition(true, false, false); $result = $design->update($original); if ($result === false) { common_log_db_error($design, 'UPDATE', __FILE__); // TRANS: Error message displayed if design settings could not be saved. $this->showForm(_('Couldn\'t update your design.')); return; } } }
/** * Data elements of the form * * @return void */ function formData() { $this->out->elementStart('fieldset', array('id' => 'settings_design_logo')); $this->out->element('legend', null, _('Change logo')); $this->out->elementStart('ul', 'form_data'); $this->li(); $this->input('logo', _('Site logo'), 'Logo for the site (full URL)'); $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => 'settings_design_theme')); $this->out->element('legend', null, _('Change theme')); $this->out->elementStart('ul', 'form_data'); $themes = Theme::listAvailable(); // XXX: listAvailable() can return an empty list if you // screw up your settings, so just in case: if (empty($themes)) { $themes = array('default', 'default'); } asort($themes); $themes = array_combine($themes, $themes); $this->li(); $this->out->dropdown('theme', _('Site theme'), $themes, _('Theme for the site.'), false, $this->value('theme')); $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); $design = $this->out->design; $this->out->elementStart('fieldset', array('id' => 'settings_design_background-image')); $this->out->element('legend', null, _('Change background image')); $this->out->elementStart('ul', 'form_data'); $this->li(); $this->out->element('label', array('for' => 'design_background-image_file'), _('Background')); $this->out->element('input', array('name' => 'design_background-image_file', 'type' => 'file', 'id' => 'design_background-image_file')); $this->out->element('p', 'form_guide', sprintf(_('You can upload a background image for the site. ' . 'The maximum file size is %1$s.'), ImageFile::maxFileSize())); $this->out->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', 'value' => ImageFile::maxFileSizeInt())); $this->unli(); if (!empty($design->backgroundimage)) { $this->out->elementStart('li', array('id' => 'design_background-image_onoff')); $this->out->element('img', array('src' => Design::url($design->backgroundimage))); $attrs = array('name' => 'design_background-image_onoff', 'type' => 'radio', 'id' => 'design_background-image_on', 'class' => 'radio', 'value' => 'on'); if ($design->disposition & BACKGROUND_ON) { $attrs['checked'] = 'checked'; } $this->out->element('input', $attrs); $this->out->element('label', array('for' => 'design_background-image_on', 'class' => 'radio'), _('On')); $attrs = array('name' => 'design_background-image_onoff', 'type' => 'radio', 'id' => 'design_background-image_off', 'class' => 'radio', 'value' => 'off'); if ($design->disposition & BACKGROUND_OFF) { $attrs['checked'] = 'checked'; } $this->out->element('input', $attrs); $this->out->element('label', array('for' => 'design_background-image_off', 'class' => 'radio'), _('Off')); $this->out->element('p', 'form_guide', _('Turn background image on or off.')); $this->unli(); $this->li(); $this->out->checkbox('design_background-image_repeat', _('Tile background image'), $design->disposition & BACKGROUND_TILE ? true : false); $this->unli(); } $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => 'settings_design_color')); $this->out->element('legend', null, _('Change colours')); $this->out->elementStart('ul', 'form_data'); try { $bgcolor = new WebColor($design->backgroundcolor); $this->li(); $this->out->element('label', array('for' => 'swatch-1'), _('Background')); $this->out->element('input', array('name' => 'design_background', 'type' => 'text', 'id' => 'swatch-1', 'class' => 'swatch', 'maxlength' => '7', 'size' => '7', 'value' => '')); $this->unli(); $ccolor = new WebColor($design->contentcolor); $this->li(); $this->out->element('label', array('for' => 'swatch-2'), _('Content')); $this->out->element('input', array('name' => 'design_content', 'type' => 'text', 'id' => 'swatch-2', 'class' => 'swatch', 'maxlength' => '7', 'size' => '7', 'value' => '')); $this->unli(); $sbcolor = new WebColor($design->sidebarcolor); $this->li(); $this->out->element('label', array('for' => 'swatch-3'), _('Sidebar')); $this->out->element('input', array('name' => 'design_sidebar', 'type' => 'text', 'id' => 'swatch-3', 'class' => 'swatch', 'maxlength' => '7', 'size' => '7', 'value' => '')); $this->unli(); $tcolor = new WebColor($design->textcolor); $this->li(); $this->out->element('label', array('for' => 'swatch-4'), _('Text')); $this->out->element('input', array('name' => 'design_text', 'type' => 'text', 'id' => 'swatch-4', 'class' => 'swatch', 'maxlength' => '7', 'size' => '7', 'value' => '')); $this->unli(); $lcolor = new WebColor($design->linkcolor); $this->li(); $this->out->element('label', array('for' => 'swatch-5'), _('Links')); $this->out->element('input', array('name' => 'design_links', 'type' => 'text', 'id' => 'swatch-5', 'class' => 'swatch', 'maxlength' => '7', 'size' => '7', 'value' => '')); $this->unli(); } catch (WebColorException $e) { common_log(LOG_ERR, 'Bad color values in site design: ' . $e->getMessage()); } $this->out->elementEnd('fieldset'); $this->out->elementEnd('ul'); }
function clearDesigns() { $designs = $this->getDesigns(); if (is_array($designs)) { foreach ($this->getDesigns() as $id_design) { $design = new Design($this->db); $design->setId($id_design); if (!$design->delete()) { $this->last_error = $design->last_error; return false; } } return true; } else { $this->last_error = "Empty Design Array: " . $this->last_error; return false; } }
/** * Save or update the group's design settings * * @return void */ function saveDesign() { try { $bgcolor = new WebColor($this->trimmed('design_background')); $ccolor = new WebColor($this->trimmed('design_content')); $sbcolor = new WebColor($this->trimmed('design_sidebar')); $tcolor = new WebColor($this->trimmed('design_text')); $lcolor = new WebColor($this->trimmed('design_links')); } catch (WebColorException $e) { $this->showForm($e->getMessage()); return; } $onoff = $this->arg('design_background-image_onoff'); $on = false; $off = false; $tile = false; if ($onoff == 'on') { $on = true; } else { $off = true; } $repeat = $this->boolean('design_background-image_repeat'); if ($repeat) { $tile = true; } $design = $this->group->getDesign(); if (!empty($design)) { // update design $original = clone $design; $design->backgroundcolor = $bgcolor->intValue(); $design->contentcolor = $ccolor->intValue(); $design->sidebarcolor = $sbcolor->intValue(); $design->textcolor = $tcolor->intValue(); $design->linkcolor = $lcolor->intValue(); $design->setDisposition($on, $off, $tile); $result = $design->update($original); if ($result === false) { common_log_db_error($design, 'UPDATE', __FILE__); $this->showForm(_('Couldn\'t update your design.')); return; } } else { $this->group->query('BEGIN'); // save new design $design = new Design(); $design->backgroundcolor = $bgcolor->intValue(); $design->contentcolor = $ccolor->intValue(); $design->sidebarcolor = $sbcolor->intValue(); $design->textcolor = $tcolor->intValue(); $design->linkcolor = $lcolor->intValue(); $design->setDisposition($on, $off, $tile); $id = $design->insert(); if (empty($id)) { common_log_db_error($id, 'INSERT', __FILE__); $this->showForm(_('Unable to save your design settings!')); return; } $original = clone $this->group; $this->group->design_id = $id; $result = $this->group->update($original); if (empty($result)) { common_log_db_error($original, 'UPDATE', __FILE__); $this->showForm(_('Unable to save your design settings!')); $this->group->query('ROLLBACK'); return; } $this->group->query('COMMIT'); } $this->saveBackgroundImage($design); $this->showForm(_('Design preferences saved.'), true); }
public static function show($console, $result, $data) { $pluginFiles = array(); if ($handle = @opendir(dirname(__FILE__) . '/../../Plugins')) { while (false !== ($file = readdir($handle))) { if (substr($file, -5) != '.json' || $file == '.' || $file == '..') { continue; } if (is_dir(dirname(__FILE__) . '/../../Plugins/' . $file)) { continue; } $pluginFiles[] = $file; } closedir($handle); } $text = ''; $text .= Design::erstelleBeschreibung($console, Language::Get('packages', 'description')); if (self::$onEvents['install']['enabledInstall']) { $text .= Design::erstelleZeile($console, Language::Get('packages', 'installSelected'), 'e', '', 'v', Design::erstelleSubmitButton(self::$onEvents['install']['event'][0], Language::Get('main', 'install')), 'h'); } if (self::$onEvents['uninstall']['enabledInstall']) { $text .= Design::erstelleZeile($console, Language::Get('packages', 'uninstallSelected'), 'e', '', 'v', Design::erstelleSubmitButton(self::$onEvents['uninstall']['event'][0], Language::Get('main', 'uninstall')), 'h'); } if (self::$onEvents['validateFiles']['enabledInstall']) { $text .= Design::erstelleZeile($console, Language::Get('packages', 'validateFilesDesc'), 'e', '', 'v', Design::erstelleSubmitButton(self::$onEvents['validateFiles']['event'][0], Language::Get('packages', 'validateFiles')), 'h'); } $validateFiles = false; if (isset($result[self::$onEvents['validateFiles']['name']])) { $validateFiles = true; } if (isset($result[self::$onEvents['check']['name']]) && $result[self::$onEvents['check']['name']] != null) { $result = $result[self::$onEvents['check']['name']]; } else { $result = array('content' => null, 'fail' => false, 'errno' => null, 'error' => null); } $installedPlugins = $result['content']; // hier die möglichen Erweiterungen ausgeben, zudem noch die Daten dieser Erweiterungen foreach ($pluginFiles as $plug) { $dat = file_get_contents(dirname(__FILE__) . '/../../Plugins/' . $plug); $dat = json_decode($dat, true); $name = $dat['name']; $version = $dat['version']; $voraussetzungen = $dat['requirements']; if (!is_array($voraussetzungen)) { $voraussetzungen = array($voraussetzungen); } $text .= Design::erstelleZeile($console, "{$name} v{$dat['version']}", 'e', self::$onEvents['install']['enabledInstall'] || self::$onEvents['uninstall']['enabledInstall'] ? Design::erstelleAuswahl($console, $data['PLUG']['plug_install_' . $name], 'data[PLUG][plug_install_' . $name . ']', $plug, null, true) : '', 'v'); $isInstalled = false; if (isset($installedPlugins)) { foreach ($installedPlugins as $instPlug) { if ($name == $instPlug['name']) { if (isset($instPlug['version'])) { $text .= Design::erstelleZeile($console, Language::Get('packages', 'currentVersion'), 'v', 'v' . $instPlug['version'], 'v'); } else { $text .= Design::erstelleZeile($console, Language::Get('packages', 'currentVersion'), 'v', '???', 'v'); } $isInstalled = true; break; } } } if (!$isInstalled) { $text .= Design::erstelleZeile($console, Language::Get('packages', 'currentVersion'), 'v', '---', 'v'); } $vorText = ''; foreach ($voraussetzungen as $vor) { $vorText .= "{$vor['name']} v{$vor['version']}, "; } if ($vorText == '') { $vorText = '---'; } else { $vorText = substr($vorText, 0, -2); } $text .= Design::erstelleZeile($console, Language::Get('packages', 'requirements'), 'v', $vorText, 'v'); $file = dirname(__FILE__) . '/../../Plugins/' . $plug; $fileCount = 0; $fileSize = 0; $componentCount = 0; if (file_exists($file) && is_readable($file)) { $input = file_get_contents($file); $input = json_decode($input, true); if ($input == null) { $fail = true; break; } $fileList = array(); $fileListAddress = array(); $componentFiles = array(); self::gibPluginDateien($input, $fileList, $fileListAddress, $componentFiles); $fileCount = count($fileList); foreach ($fileList as $f) { if (is_readable($f)) { $fileSize += filesize($f); if ($validateFiles) { if ($fileSize > 0 && strtolower(substr($f, -5)) === '.json') { // validiere die json Datei $cont = file_get_contents($f); if (trim($cont) != '') { $val = @json_decode(file_get_contents($f)); if ($val === null) { $text .= Design::erstelleZeileShort($console, realpath($f), 'break v', Language::Get('packages', 'jsonInvalid'), 'v error_light break'); } } } if ($fileSize > 0 && strtolower(substr($f, -4)) === '.php') { // validiere die php Datei $output = null; $result = null; exec('(php -l -d error_reporting=E_ALL -d display_errors=on -d log_errors=off -f ' . realpath($f) . ') 2>&1', $output, $result); if ($result != 0) { $text .= Design::erstelleZeileShort($console, realpath($f), 'break v', implode('<br>', $output), 'v error_light break'); } } } } } $componentCount = count($componentFiles); } $text .= Design::erstelleZeile($console, Language::Get('packages', 'numberComponents'), 'v', $componentCount, 'v'); $text .= Design::erstelleZeile($console, Language::Get('packages', 'numberFiles'), 'v', $fileCount, 'v'); $text .= Design::erstelleZeile($console, Language::Get('packages', 'size'), 'v', Design::formatBytes($fileSize), 'v'); } /*if ($installPlugins){ if ($installPluginsResult !=null) foreach ($installPluginsResult as $component){ // $text .= "<tr><td class='e' rowspan='1'>{$component}</td><td class='v'></td><td class='e'><div align ='center'>".((isset($dat['status']) && $dat['status']===201) ? Language::Get('main','ok') : "<font color='red'>".Language::Get('main','fail')." ({$dat['status']})</font>")."</align></td></tr>"; } $text .= Design::erstelleInstallationszeile($console, $fail, $errno, $error); } if ($uninstallPlugins){ if ($uninstallPluginsResult !=null) foreach ($uninstallPluginsResult as $component){ // $text .= "<tr><td class='e' rowspan='1'>{$component}</td><td class='v'></td><td class='e'><div align ='center'>".((isset($dat['status']) && $dat['status']===201) ? Language::Get('main','ok') : "<font color='red'>".Language::Get('main','fail')." ({$dat['status']})</font>")."</align></td></tr>"; } $text .= Design::erstelleInstallationszeile($console, $fail, $errno, $error); }*/ echo Design::erstelleBlock($console, Language::Get('packages', 'title'), $text); return null; }