function userlist() { if (!F3::get('SESSION.asid')) { F3: reroute('/admin'); } $user = new Axon('tbl_user'); $users = array(); $user_list = $user->find(); if ($user_list != NULL) { foreach ($user_list as $ul) { $users[] = array($ul->email, $ul->username, '<img src="' . $ul->image . '" width="20px" height="20px" /> ' . $ul->fullname, $ul->active == 'y' ? 'Yes' : 'No', '<center><a href="#" class="blockLink" data-id="' . $ul->id . '">' . ($ul->active == 'y' ? 'Block' : 'Unblock') . '</a><br/><a href="#" class="deleteLink" data-id="' . $ul->id . '">Delete</a></center>'); } $i = 0; foreach ($user_list as $user) { $user_id[] = $user_list[$i]->id; $i++; } } else { $users = 0; $user_id = 0; } $this->set('identity', $user_id); $this->set('userList', $users); $this->set('title', 'User'); if (Snippets::_isAjax()) { echo Template::serve("template/admin/user.htm"); } else { $this->set('template', 'user'); echo Template::serve("template/admin/layout.htm"); } }
public function createAndServe($id, $msg = '') { $db = new Database(); $data = $db->getData($id); $template = new Template($id, $data); $template->serve(); $logs = new Logger(); // $logs->log("Create a page for ID {$id}"); $logs->log($msg); }
function user_home() { $id = F3::get("PARAMS.sid"); if (F3::get("SESSION.onlineUser")) { F3::set('navUser', 'userNav'); $this->list_saved_form(); F3::set('template', 'home'); echo Template::serve("template/layout.html"); } else { F3::reroute('/'); } }
function all() { $poll = new Axon('tbl_poll'); // echo 123;die; // $this->set('title', 'Quizzes'); $poll->def('fullname', 'SELECT fullname FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id'); $poll->def('image', 'SELECT image FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id'); $poll->def('hits', 'SELECT COUNT(date) FROM tbl_vote WHERE tbl_poll.id=tbl_vote.poll_id'); $q = $poll->find('published_date IS NOT NULL AND is_archive="n" AND expiry_date>now() AND private="n"'); $polls = array(); foreach ($q as $qu) { $polls[$qu->id] = array(strtoupper($qu->keyword), $qu->question, '<img src="' . $qu->image . '" width="20px" height="20px" /> ' . $qu->fullname); } $this->set('title', 'All polls'); $this->set('pollList', $polls); $this->set('template', 'all'); echo Template::serve("template/layout.htm"); }
public static function _showError($message = "") { if (Snippets::_isAjax()) { if (Snippets::_isPost()) { $ret = array('error' => true); if ($message == "") { $message = F3::get('ERROR.text'); } $ret['message'] = $message; echo json_encode($ret); } else { $ret = 'error'; if ($message == "") { $message = F3::get('ERROR.text'); } $ret .= " [{$message}]"; echo $ret; } } else { F3::set('title', 'Page Not Found'); F3::set('template', 'error'); echo Template::serve("template/layout.htm"); } }
//###Check if file uploaded successfully if ($uploadResult->status == "Ok") { $fileGuId = $uploadResult->result->guid; } else { throw new Exception($uploadResult->error_message); } } //Make request yo the Api to get images for all document pages $pageImage = $api->GetDocumentPagesImageUrls($clientId, $fileGuId, 0, null, '650x500', null, null, null); $url = ""; $image = ""; //Check the result of the request if ($pageImage->status == "Ok") { //### If request was successfull for ($i = 0; $i < count($pageImage->result->url); $i++) { $image .= '<img src="' . $pageImage->result->url[$i] . '"></img><br/>'; } } else { throw new Exception($pageImage->error_message); } //Set variable with results for template F3::set("fileId", $fileGuId); F3::set('image', $image); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } //Process template echo Template::serve('sample23.htm');
function getSavedNamsari() { if (!F3::get('SESSION.onlineUser')) { F3::reroute("/"); } $id = new Form_elements(); $date = DATE('Y-m-d'); $id = new Form_elements(); $owner_type = $id->owner_type(); $zone_code = $id->zone_code(); $district_code = $id->district_code(); $date = DATE('Y-m-d'); $zone_code = $id->zone_code(); $type_symbol = $id->type_symbol(); $vehicle = F3::get("PARAMS.trans"); $data = new Axon("vehicle"); $owner = new Axon("owner"); $namsari = new Axon("namsari"); if ($data->found(array('id=:id', array(':id' => $vehicle))) && $owner->found(array('vehicleid =:id', array(':id' => $vehicle))) && $namsari->found(array('vehicle_id=:id', array(':id' => $vehicle)))) { $data->load(array('id=:id', array(':id' => $vehicle))); $owner->load(array('vehicleid =:id', array(':id' => $vehicle))); $namsari->load(array('vehicle_id =:id', array(':id' => $vehicle))); $owner_photo = new Axon("owner_photo"); if ($owner_photo->found(array('vehicle_id=:pic', array(':pic' => $vehicle)))) { $owner_photo->load(array('vehicle_id=:pic', array(':pic' => $vehicle))); $owner_photo->copyTo("POST"); } // var_dump($data->find("id='$vehicle'"));die; $data->copyTo("POST"); $owner->copyTo("POST"); $namsari->copyTo("POST"); F3::set('heading', 'नया सवारी धनी विवरण '); F3::set('date', $date); F3::set('navUser', 'userNav'); F3::set('title', 'Admin - approve Namsari'); F3::set('template', 'transfer'); echo Template::serve("template/layout.html"); } }
F3::set('config_permissions', $settings->config_permissions); $status_buttons = Template::serve('ui/status_buttons.html'); F3::set('status_buttons', Template::serve('ui/status_buttons.html')); F3::set('content', Template::serve('ui/settings.html')); echo Template::serve('ui/template.html'); } */ F3::route('GET /settings', function () { global $settings; $settings->settings_page_data(); F3::set('company_logos', $settings->company_logos); // F3::set('debug', $settings->debug); F3::set('config_permissions', $settings->config_permissions); $status_buttons = Template::serve('ui/status_buttons.html'); F3::set('status_buttons', Template::serve('ui/status_buttons.html')); F3::set('content', Template::serve('ui/settings.html')); echo Template::serve('ui/template.html'); }); F3::route('GET /set_permissions', function () { global $settings; $settings->set_permissions(); F3::reroute('/settings'); }); F3::route('POST /save_settings', function () { $post_data = $_POST; $settings = new Settings(); $settings->save(); F3::reroute('/settings'); }); F3::route('GET /debug', 'debug.php'); F3::run();
function getTOU() { $this->set('title', 'Terms of Use'); F3::set('template', 'tou'); echo Template::serve("template/layout.htm"); }
function reportLog() { if (F3::get('SESSION.asid')) { F3::reroute("/admin"); } $admin = new Axon("admin_log"); // $users=$admin->afind(); $date1 = F3::get("POST.date1"); $date2 = F3::get("POST.date2"); if ($users = $admin->found()) { // var_dump($users);die; $users = $admin->afind("date between '" . $date1 . "' and '" . $date2 . "'"); F3::set('report', $users); F3::set('nav', 'navigation'); F3::set('title', 'Admin - Log'); F3::set('templateAdmin', 'adminLog'); echo Template::serve("template/layout.html"); } else { $users = array(); F3::set('report', $users); F3::set('nav', 'navigation'); F3::set('templateAdmin', 'adminLog'); echo Template::serve("template/layout.html"); } }
if ($createAnnotation->result) { //Generation of iframe URL using fileGuId if ($basePath == "https://api.groupdocs.com/v2.0") { $iframe = 'http://apps.groupdocs.com/document-annotation2/embed/' . $createAnnotation->result->documentGuid . '?frameborder="0" width="720" height="600"'; //iframe to dev server } elseif ($basePath == "https://dev-api.groupdocs.com/v2.0") { $iframe = 'http://dev-apps.groupdocs.com/document-annotation2/embed/' . $createAnnotation->result->documentGuid . '?frameborder="0" width="720" height="600"'; //iframe to test server } elseif ($basePath == "https://stage-api-groupdocs.dynabic.com/v2.0") { $iframe = 'https://stage-apps-groupdocs.dynabic.com/document-annotation2/Embed/' . $createAnnotation->result->documentGuid . '?frameborder="0" width="720" height="600"'; //Iframe to realtime server } elseif ($basePath == "http://realtime-api.groupdocs.com") { $iframe = 'http://realtime-apps.groupdocs.com/document-annotation2/embed/' . $createAnnotation->result->documentGuid . '?frameborder="0" width="720" height="600"'; } $iframe = $signer->signUrl($iframe); F3::set('annotationId', $createAnnotation->result->annotationGuid); F3::set('annotationType', $annotationType); F3::set('annotationText', $replyText); F3::set('url', $iframe); } } else { throw new Exception($createAnnotation->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } } // Process template echo Template::serve('sample11.htm');
function register_print() { $id = F3::get("PARAMS.id"); $vehicle = F3::get("PARAMS.id"); $data = new Axon("vehicle"); $owner = new Axon("owner"); if ($data->found(array('id=:id', array(':id' => $id))) && $owner->found(array('vehicleid =:id', array(':id' => $id)))) { // echo 123; $data->load(array('id=:id', array(':id' => $vehicle))); $owner->load(array('vehicleid =:id', array(':id' => $vehicle))); // $namsari->load(array('vehicle_id =:id', array(':id' => $vehicle))); $zone_code = $id->zone_view($data->zone_id); // F3::set('code', $zone_code); $symbol_view = $id->symbol_view($data->vehicle_symbol_type); $owner_view = $id->owner_view($owner->owner_type); $p_zone_id = $id->zone_view($owner->p_zone_id); $temp_zone_id = $id->zone_view($owner->temp_zone_id); // F3::set('zone', $p_zone_id); //$p_district_id = $id->district_view($data->p_district_id); // $temp_district_id = $id->district_view($data->temp_district_id); $nabalik_district = $id->district_view($data->nabalik_district); $creditor_district = $id->district_view($data->creditor_district); $per_district = $id->district_view($data->per_district); $owner->copyTo("POST"); $data->copyTo("POST"); $namsari->copyTo("POST"); F3::set('date', $date); // F3::set('nav', 'navigation'); echo Template::serve("template/admin/registration_print.htm"); } }
function transfer_ownership() { if (!F3::get('SESSION.onlineUser')) { F3::reroute("/"); } $id = new Form_elements(); $owner_type = $id->owner_type(); $zone_code = $id->zone_code(); $district_code = $id->district_code(); $date = DATE('Y-m-d'); F3::set('date', $date); // F3::set('heading', 'नया सवारी धनी विवरण '); $zone_code = $id->zone_code(); $type_symbol = $id->type_symbol(); F3::set('date', $date); F3::set('title', 'सवारी नामसारी '); F3::set('navUser', 'userNav'); F3::set('template', 'transfer'); echo Template::serve("template/layout.html"); }
<?php //echo 123;die; $main = (require __DIR__ . './lib/base.php'); $main->set('DEBUG', 3); $main->set('UI', 'ui/'); $main->set('AUTOLOAD', 'app/'); $main->set('DB', new DB('mysql:host=localhost;dbname=polls', 'root', '')); // Site title $main->set('site', 'SMSCentral Poll Application'); $main->set('conf', array('PAGESIZE' => 20, 'imes' => 'Invalid poll', 'tmes' => 'Thank you for your vote', 'mes' => " '<br>'Create your own poll. Log on to: www.smscentral.com.np/poll", 'smes' => 'Check out this poll')); $main->set('ONERROR', function () { F3::set('template', 'error'); echo Template::serve("template/layout.htm"); }); //before session $main->route('GET /home', 'App->getHome;'); $main->route('GET /poll/@pid', 'App->view;'); $main->route('GET /pollView/@pid', 'App->pollView'); //user functionality $main->route('GET /logout', 'User->logout;'); $main->route('GET /login/@sid', 'User->login'); $main->route('POST /login', 'User->login'); //user functionality for polls $main->route('GET /terms', 'App->getTOU'); $main->route('GET /create', 'App->create'); //shows form $main->route('GET /myPolls', 'App->mypolls;'); $main->route('GET /polls/@id', 'App->mypolls;'); $main->route('POST /myPolls', 'Poll->add;'); //add and store poll to database
public static function onError($message = "") { F3::set('templateAdmin', 'error'); echo Template::serve("template/layout.html"); }
/** Process run, now serve the template **/ function afterroute() { //Default serve the layout template echo Template::serve('layout.htm'); }
<?php echo Template::serve('popup.htm');
function helpTransfer() { F3::set('navUser', 'userNav'); F3::set('template', 'helpTransfer'); echo Template::serve("template/layout.html"); }
function index() { F3::set('template', 'photo'); echo Template::serve("template/layout.html"); }
<?php require __DIR__ . '/lib/base.php'; F3::set('CACHE', FALSE); F3::set('DEBUG', 1); F3::set('UI', 'ui/'); F3::route('GET /index.php', function () { F3::set('modules', array('apc' => 'Cache engine', 'gd' => 'Graphics plugin', 'hash' => 'Framework core', 'imap' => 'Authentication', 'json' => 'Various plugins', 'ldap' => 'Authentication', 'memcache' => 'Cache engine', 'mongo' => 'M2 MongoDB mapper', 'pcre' => 'Framework core', 'pdo_mssql' => 'SQL handler, Axon ORM, Authentication', 'pdo_mysql' => 'SQL handler, Axon ORM, Authentication', 'pdo_pgsql' => 'SQL handler, Axon ORM, Authentication', 'pdo_sqlite' => 'SQL handler, Axon ORM, Authentication', 'session' => 'Framework core', 'sockets' => 'Network plugin', 'xcache' => 'Cache engine')); echo Template::serve('welcome.htm'); }); F3::run();
$user->load(array('fb_id=:fb_id', array(':fb_id' => $uid))); if ($user->dry()) { _force_logout(); } // Make user a var for template use F3::set('user', array('fb_id' => $user->fb_id, 'name' => $user->name, 'email_opt' => $user->email_opt)); if (isset($_SESSION['message'])) { F3::set('message', $_SESSION['message']); F3::set('extra_js', array('bootstrap-alert.js')); unset($_SESSION['message']); } F3::set('extra_css', array('settings.css')); echo Template::serve('templates/header.html'); F3::set('page', 'general_settings'); echo Template::serve('templates/settings.html'); echo Template::serve('templates/footer.html'); die; }); F3::route('POST /settings/save', function () { $facebook = F3::get('Facebook'); $uid = $facebook->getUser(); if (!$uid) { _force_logout(); } $user = new Axon('user'); $user->load(array('fb_id=:fb_id', array(':fb_id' => $uid))); if ($user->dry()) { _force_logout(); } $email_opt = F3::get('POST.email_opt') == 'on' ? TRUE : False; $user->email_opt = $email_opt;
function approveNamsari() { if (!F3::get('SESSION.asid')) { F3::reroute("/admin"); } $vehicle = F3::get("PARAMS.id"); $sql = DB::SQL("select vehicleid from vehicle where id=111"); $wheeler = F3::get("POST.wheeler"); $zone_id = F3::get("POST.zone_id"); $lot_number = F3::get("POST.lot_number"); $vehicle_symbol_type = $wheeler == 21 ? F3::get("POST.vehicle_symbol_type_two") : F3::get("POST.vehicle_symbol_type_four"); $number = F3::get("POST.number"); $user = new User(); $vehicleid = $user->vehicleid($wheeler, $zone_id, $lot_number, $vehicle_symbol_type, $number); //table namsari $reason = F3::get("POST.reason"); $date = F3::get("POST.date"); $remarks = F3::get("POST.remarks"); $witness_name = F3::get("POST.witness_name"); $witness_address = F3::get("POST.witness_address"); $citizenship_no = F3::get("POST.citizenship_no"); //owner table $owner_type = F3::get("POST.owner_type"); $first_name = F3::get("POST.first_name"); $last_name = F3::get("POST.last_name"); $father_name = F3::get("POST.father_name"); $grandfather_name = F3::get("POST.grandfather_name"); $dob = F3::get("POST.dob"); $reg_num = F3::get("POST.reg_num"); $email = F3::get("POST.email"); $mobile = F3::get("POST.mobileno"); $p_zone_id = F3::get("POST.p_zone_id"); $p_district_id = F3::get("POST.p_district_id"); $p_metropolitan = F3::get("POST.p_metropolitan"); $p_ward_no = F3::get("POST.p_ward_no"); $p_address = F3::get("POST.p_address"); $p_house_no = F3::get("POST.p_house_no"); $p_phone = F3::get("POST.p_phone"); $temp_zone_id = F3::get("POST.temp_zone_id"); $temp_district_id = F3::get("POST.temp_district_id"); $temp_metropolitan = F3::get("POST.temp_metropolitan"); $temp_ward_no = F3::get("POST.temp_ward_no"); $temp_address = F3::get("POST.temp_address"); $temp_house_no = F3::get("POST.temp_house_no"); $temp_phone = F3::get("POST.temp_phone"); $nabalik_guardian_name = F3::get("POST.nabalik_guardian_name"); $nabalik_relation = F3::get("POST.nabalik_relation"); $nabalik_identity_no = F3::get("POST.nabalik_identity_no"); $nabalik_district = F3::get("POST.nabalik_district"); $nabalik_year = F3::get("POST.nabalik_year"); $nabalik_address = F3::get("POST.nabalik_address"); $bank_name = F3::get("POST.bank_name"); $creditor_name = F3::get("POST.creditor_name"); $creditor_district = F3::get("POST.creditor_district"); $creditor_year = F3::get("POST.creditor_year"); $creditor_address = F3::get("POST.creditor_address"); $per_nagarikta = F3::get("POST.per_nagarikta"); $per_identificationno = F3::get("POST.per_identificationno"); $per_district = F3::get("POST.per_district"); $per_year = F3::get("POST.per_year"); $indian_identificationno = F3::get("POST.indian_identificationno"); $other_identificationno = F3::get("POST.other_identificationno"); //online edit by the operator $onlineSql[] = "update vehicle set wheeler='{$wheeler}',vehicleid='{$vehicleid}',zone_id='{$zone_id}',lot_number='{$lot_number}',\n vehicle_symbol_type='{$vehicle_symbol_type}', number='{$number}', status='approved' where id='" . $vehicle . "'"; $onlineSql[] = "update namsari set reason='{$reason}',date='{$date}',remarks='{$remarks}',witness_name='{$witness_name}',witness_address='{$witness_address}',citizenship_no='{$citizenship_no}'where id='" . $vehicle . "'"; $onlineSql[] = "update owner set owner_type='{$owner_type}',first_name='{$first_name}',last_name='{$last_name}', father_name='{$father_name}',\n grandfather_name='{$grandfather_name}',dob='{$dob}',reg_num='{$reg_num}',email='{$email}',mobileno='{$mobile}',p_zone_id='{$p_zone_id}',p_district_id='{$p_district_id}',\n p_metropolitan='{$p_metropolitan}',p_ward_no='{$p_ward_no}',p_address='{$p_address}', p_house_no='{$p_house_no}', p_phone='{$p_phone}',\n temp_zone_id='{$temp_zone_id}',temp_district_id='{$temp_district_id}', temp_metropolitan='{$temp_metropolitan}', temp_ward_no='{$temp_ward_no}', temp_address='{$temp_address}',temp_house_no='{$temp_house_no}',\n temp_phone='{$temp_phone}', nabalik_guardian_name='{$nabalik_guardian_name}',nabalik_relation='{$nabalik_relation}',\n nabalik_identity_no='{$nabalik_identity_no}', nabalik_district='{$nabalik_district}', nabalik_year='{$nabalik_year}', nabalik_address='{$nabalik_address}',\n bank_name='{$bank_name}', creditor_name='{$creditor_name}',\n creditor_district='{$creditor_district}', creditor_year='{$creditor_year}', creditor_address='{$creditor_address}',per_nagarikta='{$per_nagarikta}',\n per_identificationno='{$per_identificationno}',per_district='{$per_district}',per_year='{$per_year}',indian_identificationno='{$indian_identificationno}' ,other_identificationno='{$other_identificationno}' where vehicleid='" . $vehicle . "'"; // // $zone = Admin::getZone($zone_id); $symbol = Admin::getSymbolType($vehicle_symbol_type); $vehicleNo = $zone . $lot_number . $symbol . $number; F3::set('DB', new DB(F3::get("db_param.live_host"), F3::get("db_param.live_user"), F3::get("db_param.live_password"))); $old_owner_id = DB::sql("select owner_id from vehicle where id='" . $vehicleid . "'"); //check whether id is int if (count($old_owner_id) > 0) { $sqls[] = "INSERT INTO owner\n (name,caste,dob,email,owner_type_id,father_name,g_father_name,mobileno,p_district,p_zone_id,\n p_nagarpalika,p_wardno, p_tole,p_gharno,p_phone,t_district,t_zone_id,t_nagarpalika,t_wardno,t_tole,\n t_gharno,t_phone,nab_guardian_name,nab_relation,nab_identificationno,nab_district,nab_year,nab_address,per_nagarikta, per_identificationno,\n per_district,per_year,bank_name,bank_identificationno,bank_district, bank_year,bank_address) VALUES\n ('{$first_name}', '{$last_name}','{$dob}','{$email}','{$owner_type}','{$father_name}','{$grandfather_name}', '{$mobile}',' {$p_district_id}',' {$p_zone_id}',\n '{$p_metropolitan}', '{$p_ward_no}','{$p_address}', '{$p_house_no}', '{$p_phone}', ' {$temp_district_id}','{$temp_zone_id}', '{$temp_metropolitan}',' {$temp_ward_no}','{$temp_address}',\n ' {$temp_house_no}',' {$temp_phone}', '{$nabalik_guardian_name}',' {$nabalik_relation}', '{$nabalik_identity_no}', '{$nabalik_district}', '{$nabalik_year}', '{$nabalik_address}','{$per_nagarikta}','{$per_identificationno}',\n '{$per_district}', '{$per_year}', '{$bank_name}', '{$creditor_name}',' {$creditor_district}', '{$creditor_year}','{$creditor_address}')"; $sqls[] = "insert into namsari_info\n (vehicle_id,reason,date,comments, sakshi_name,sakshi_address,sakshi_identification,new_ownerid, old_ownerid,status)\n values ('{$vehicleid}','{$reason}','{$date}','{$remarks}','{$witness_name}','{$witness_address}','{$citizenship_no}',(select last_insert_id()),'" . $old_owner_id[0]['owner_id'] . "','initial')"; //set db to remote DB::sql($sqls); $photo_name = DB::sql("select new_ownerid from namsari_info where vehicle_id='" . $vehicleid . "' order by new_ownerid desc"); //update photo $onlineSql[] = "update owner_photo set picture='" . $photo_name[0]['new_ownerid'] . ".jpg' where vehicle_id='" . $vehicle . "'"; //set db to old one F3::set('DB', new DB(F3::get("local_param.local_host"), F3::get("local_param.local_user"), F3::get("local_param.local_password"))); DB::SQL($onlineSql); rename("photo/" . $vehicle . ".jpg", "photo/" . $photo_name[0]['new_ownerid'] . ".jpg"); AdminLog::add($vehicleNo, "namsari", "approved"); //success message F3::set('nav', 'navigation'); F3::set('message', 'The data has been approved'); F3::set('templateAdmin', 'approve'); echo Template::serve("template/layout.html"); } else { F3::set('message', 'The data doesnot exist'); F3::set('nav', 'navigation'); F3::set('templateAdmin', 'approve'); echo Template::serve("template/layout.html"); } }
$error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } } else { throw new Exception($recipient->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } } else { throw new Exception($envelop->error_message); } } else { throw new Exception($job->error_message); } } else { throw new Exception($addDataSource->error_message); } //If it isn't uploaded throw exception to template } else { throw new Exception($uploadResult->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } } //Process template echo Template::serve('sample44.htm');
function getReport() { F3::set('title', 'Report'); F3::set('template', "report"); echo Template::serve("template/admin/layout.htm"); }
} # Delete file from Api Storage try { if ($fileGuid == "") { $message = '<span style="color: red">This file is no longer available</span>'; } else { $delFile = $storageApi->Delete($clientId, $fileGuid); // Check the result of the request if ($delFile->status == "Ok") { // If status "ok" - show Mesege $message = '<span style="color: green">Done, file deleted from your GroupDocs Storage</span>'; } else { $message = '<span style="color: red">' . $delFile->error_message . '</span>'; } } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } } else { $message = '<span style="color: red">' . $allFiles->error_message . '</span>'; } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } F3::set('message', $message); } // Process template echo Template::serve('sample30.htm');
function template() { $this->set('title', 'Template Engine'); $this->set('CACHE', TRUE); $this->expect(is_null($this->get('ERROR')), 'No errors expected at this point', 'ERROR variable is set: ' . $this->get('ERROR.text')); $this->set('a', 123); $this->set('b', '{{@a}}'); $this->expect(Template::resolve('{{@b}}') == '123', 'Template token substituted; string value returned', 'Token substition failed: ' . Template::resolve('{{@b}}')); $this->expect(Template::resolve('{{@a}}') == '123', 'Template engine confirms substitution', 'Template engine failed: ' . Template::resolve('{{@a}}')); $this->set('a', 345); $this->expect(Template::resolve('{{@a}}') == '345', 'Template engine confirms replacement', 'Template engine failed: ' . Template::resolve('{{@a}}')); $this->expect(Template::resolve('{{@a+1}}') == '346', 'Mixed expression correct', 'Mixed expression failed: ' . Template::resolve('{{@a+1}}')); $this->expect(Template::resolve('{{@a + 1}}') == '346', 'Mixed expression (with whitespaces) correct', 'Mixed expression (with whitespaces) failed: ' . Template::resolve('{{@a + 1}}')); $this->set('x', '{{123}}'); $this->expect(Template::resolve('{{@x}}') == '123', 'Integer constant in template expression correct', 'Template expression is wrong: ' . Template::resolve('{{@x}}')); $this->set('i', 'hello'); $this->set('j', 'there'); $this->expect(Template::resolve('{{@i.@j}}') == 'hellothere', 'String concatenation works', 'String concatenation problem: ' . Template::resolve('{{@i.@j}}')); $this->expect(Template::resolve('{{@i. @j}}') == 'hellothere', 'String concatenation (with whitespaces) works', 'String concatenation (with whitespaces) problem: ' . Template::resolve('{{@i. @j}}')); $this->expect(Template::resolve('{{@i .@j}}') == 'hellothere', 'Variation in string concatenation (with whitespaces) works', 'Variation in string concatenation (with whitespaces) problem: ' . Template::resolve('{{@i .@j}}')); $this->expect(Template::resolve('{{ @i . @j }}') == 'hellothere', 'Liberal amounts of whitespaces produces the correct result', 'Liberal amounts of whitespaces produces strange result: ' . Template::resolve('{{ @i . @j }}')); $this->set('x', '{{345+5}}'); $this->expect(Template::resolve('{{@x}}') == '350', 'Arithmetic expression in template expression evaluated', 'Arithmetic expression is wrong: ' . Template::resolve('{{@x}}')); $this->set('x', '{{1+0.23e-4}}'); $this->expect(Template::resolve('{{@x}}') == '1.000023', 'Negative exponential float in template expression correct', 'Negative exponential float is wrong: ' . Template::resolve('{{@x}}')); $this->set('x', '{{1+0.23e+4}}'); $this->expect(Template::resolve('{{@x}}') == '2301', 'Positive exponential float in template expression correct', 'Positive exponential float is wrong: ' . Template::resolve('{{@x}}')); $this->set('x', '{{1+0.23e4}}'); $this->expect(Template::resolve('{{@x}}') == '2301', 'Unsigned exponential float in template expression correct', 'Unsigned exponential float is wrong: ' . Template::resolve('{{@x}}')); $this->set('x', '{{456+7.5}}'); $this->expect(Template::resolve('{{@x}}') == '463.5', 'Integer + float in template expression correct', 'Integer + float is wrong: ' . Template::resolve('{{@x}}')); $this->set('x', '{{(1+2)*3}}'); $this->expect(Template::resolve('{{@x}}') == '9', 'Parenthesized arithmetic expression evaluated', 'Parenthesized expression is wrong: ' . Template::resolve('{{@x}}')); $this->expect(Template::resolve('{{(@a+1)*2}}') == '692', 'Variable + arithmetic expression evaluated', 'Variable + arithmetic expression is wrong: ' . Template::resolve('{{(@a+1)*2}}')); $this->set('x', '{{(intval(1+2.25))*3}}'); $this->expect(Template::resolve('{{@x}}') == '9', 'Allowed function and nested parentheses evaluated', 'Allowed function/parentheses failed: ' . Template::resolve('{{@x}}')); $this->set('x', '{{(round(234.567,1)+(-1)+1)*2}}'); $this->expect(Template::resolve('{{@x}}') == '469.2', 'Function with multiple arguments evaluated', 'Function with multiple arguments failed: ' . Template::resolve('{{@x}}')); $this->set('x', NULL); $this->expect(Template::resolve('{{@x}}') == '', 'NULL converted to empty string', 'NULL not converted to empty string: ' . Template::resolve('{{@x}}')); $this->set('x', '{{array()}}'); $this->expect(Template::resolve('{{@x}}') == '', 'Empty array converted to empty string', 'Array conversion failed: ' . Template::resolve('{{@x}}')); $this->set('x', '{{array(1,2,3)}}'); $this->expect(Template::resolve('{{@x}}') == 'Array', 'Array converted to string \'Array\'', 'Array conversion failed: ' . Template::resolve('{{@x}}')); $this->set('x', '{{NULL}}'); $this->expect(Template::resolve('{{@x}}') == '', 'NULL value evaluated', 'Incorrect NULL evaluation: ' . Template::resolve('{{@x}}')); $this->set('x', '{{null}}'); $this->expect(Template::resolve('{{@x}}') == '', 'NULL value evaluated (case-insensitive)', 'Incorrect NULL evaluation: ' . Template::resolve('{{@x}}')); $this->set('x', '{{TRUE}}'); $this->expect(Template::resolve('{{@x}}') == '1', 'Boolean TRUE expression evaluated', 'Incorrect boolean evaluation: ' . Template::resolve('{{@x}}')); $this->set('x', '{{FALSE}}'); $this->expect(Template::resolve('{{@x}}') == '', 'Boolean FALSE expression converted to empty string', 'Incorrect boolean evaluation: ' . Template::resolve('{{@x}}')); $this->set('x', '{{0}}'); $this->expect(Template::resolve('{{@x}}') == '0', 'Zero remains as-is', 'Incorrect evaluation of integer zero: ' . Template::resolve('{{@x}}')); $this->set('x', '{{a@b.com}}'); $this->expect(Template::resolve('{{@x}}') == '\'a@b.com\'', 'E-mail address preserved', 'Incorrect interpretation of e-mail address: ' . Template::resolve('{{@x}}')); $this->set('x', '{{new CustomObj}}'); $this->expect(Template::resolve('{{@x}}') == '\'new CustomObj\'', 'Object instantiation using template engine prohibited', 'Object instantiation issue: ' . Template::resolve('{{@x}}')); $this->set('func', function ($x) { return 123; }); $this->expect(Template::resolve('{{@func("hello")}}') == 123, 'Variable containing anonymous function interpreted correctly', 'Template misunderstood variable containing anonymous function: ' . Template::resolve('{{@func("hello")}}')); $z = new stdClass(); $z->a = 123; $z->b = 345; $this->set('var', $z); $this->expect(Template::resolve('{{@var->a}}') == 123 && Template::resolve('{{@var->b}}') == 345, 'Variable containing an object interpreted correctly', 'Template misunderstood variable containing an object/properties: ' . Template::resolve('{{@var->a}}')); $z->c = function () { return 'foo'; }; $this->expect(Template::resolve('{{@var->c()}}') == 'foo', 'Variable containing an anonymous function rendered properly', 'Variable containing an anonymous function evaluated wrong: ' . Template::resolve('{{@var->c()}}')); $this->set('z.x', 'good idea'); $this->expect(Template::resolve('{{@z.x}}') == 'good idea', 'Array element evaluated', 'Array element failed: ' . Template::resolve('{{@z.x}}')); $this->expect(Template::resolve('{{@z.y}}') == '', 'Non-existent array element converted to empty string', 'Non-existent element failed: ' . Template::resolve('{{@z.y}}')); $this->set('q', ' indeed'); $this->expect(Template::resolve('{{@z.@q}}') == 'Array indeed', 'Concatenation of array and string produces expected result', 'Illegal concatenation: ' . Template::resolve('{{@z.@q}}')); $this->expect(Template::resolve('{{@z.x.@q}}') == 'good idea indeed', 'Concatenation of array element and string correct', 'Incorrect concatenation: ' . Template::resolve('{{@z.x.@q}}')); $this->set('my_plans', array('test' => 1, 'plan' => array('city_name' => 2))); $this->expect(Template::resolve('{{@my_plans[plan][city_name]}}') == 2, 'Got the right value of a deeply-nested array element', 'Incorrect evaluation of a deeply-nested array element'); $out = Template::serve('template/layout.htm'); $this->expect($out === "", 'Subtemplate not defined - none inserted', 'Subtemplate insertion issue: ' . $out); $this->set('sub', 'sub1.htm'); $this->set('test', '<i>italics</i>'); $out = Template::serve('template/layout.htm'); $this->expect($out == "<i>italics</i>", 'HTML special characters retained', 'Problem with HTML insertion: ' . $out); $this->set('sub', 'sub1.htm'); $this->set('test', '©'); $out = Template::serve('template/layout.htm'); $this->expect($out == "©", 'HTML entity inserted: ' . Template::serve('template/layout.htm'), 'Problem with HTML insertion: ' . $out); $this->set('sub', 'sub1.htm'); $this->set('test', 'אני יכול לאכול זכוכית וזה לא מזיק לי.'); $out = Template::serve('template/layout.htm'); $this->expect(Template::serve('template/layout.htm') == "אני יכול לאכול זכוכית וזה לא מזיק לי.", 'UTF-8 character set rendered correctly: ' . $out, 'UTF-8 issue: ' . $out); $this->set('sub', 'sub1.htm'); $this->set('test', 'I am here.'); $out = Template::serve('template/layout.htm'); $this->expect(Template::serve('template/layout.htm') == "I am here.", 'HTML entities preserved: ' . $out, 'HTML entities converted: ' . $out); $this->set('sub', 'sub2.htm'); $this->set('src', '/test/image'); $this->set('alt', htmlspecialchars('this is "the" life')); $out = Template::serve('template/layout.htm'); $this->expect($out == '<img src="/test/image" alt="this is "the" life"/>', 'Double-quotes inside HTML attributes converted to XML entities', 'Problem with double-quotes inside HTML attributes: ' . $out); $this->set('sub', 'sub3.htm'); $out = Template::serve('template/layout.htm'); $this->clear('div'); $this->expect($out == '', 'Undefined array renders empty output', 'Output not empty: ' . $out); $this->set('sub', 'sub3.htm'); $out = Template::serve('template/layout.htm'); $this->set('div', NULL); $this->expect($out == '', 'NULL used as group attribute renders empty output', 'Output not empty: ' . $out); $this->set('sub', 'sub3.htm'); $out = Template::serve('template/layout.htm'); $this->set('div', array()); $this->expect($out == '', 'Empty array used as group attribute renders empty output', 'Output not empty: ' . $out); $this->set('sub', 'sub3.htm'); $this->set('div', array('coffee' => array('arabica', 'barako', 'liberica', 'kopiluwak'), 'tea' => array('darjeeling', 'pekoe', 'samovar'))); $out = Template::serve('template/layout.htm'); $this->expect(preg_match('#' . '<div>\\s+' . '<p><span><b>coffee</b></span></p>\\s+' . '<p>\\s+' . '<span>arabica</span>\\s+' . '<span>barako</span>\\s+' . '<span>liberica</span>\\s+' . '<span>kopiluwak</span>\\s+' . '</p>\\s+' . '</div>\\s+' . '<div>\\s+' . '<p><span><b>tea</b></span></p>\\s+' . '<p>\\s+' . '<span>darjeeling</span>\\s+' . '<span>pekoe</span>\\s+' . '<span>samovar</span>\\s+' . '</p>\\s+' . '</div>' . '#s', $out), 'Subtemplate inserted; nested repeat directives rendered correctly', 'Template rendering issue: ' . $out); $this->set('sub', 'sub4.htm'); $this->set('group', array('world', 'me', 'others')); $out = Template::serve('template/layout.htm'); $this->expect(preg_match('#' . '<script type="text/javascript">\\s*' . 'function hello\\(\\) {\\s*' . 'alert\\(\'Javascript works\'\\);\\s*' . '}\\s*' . '</script>\\s*' . '<script type="text/javascript">alert\\(unescape\\("%3Cscript src=\'" \\+ gaJsHost \\+ "google-analytics\\.com/ga\\.js\' type=\'text/javascript\'%3E%3C/script%3E"\\)\\);</script>\\s' . 'world,\\s+me,\\s+others,\\s+' . '#s', $out), 'Javascript preserved', 'Javascript mangled: ' . htmlentities($out)); $this->set('sub', 'sub5.htm'); $this->set('cond1', FALSE); $this->set('cond3', FALSE); $out = trim(Template::serve('template/layout.htm')); $this->expect($out == 'c1:F,c3:F', 'Conditional directives evaluated correctly: FALSE, FALSE', 'Incorrect evaluation of conditional directives: ' . $out); $this->set('cond1', FALSE); $this->set('cond3', TRUE); $out = trim(Template::serve('template/layout.htm')); $this->expect($out == 'c1:F,c3:T', 'Conditional directives evaluated correctly: FALSE, TRUE', 'Incorrect evaluation of conditional directives: ' . $out); $this->set('cond1', TRUE); $this->set('cond2', FALSE); $out = trim(Template::serve('template/layout.htm')); $this->expect($out == 'c1:T,c2:F', 'Conditional directives evaluated correctly: TRUE, FALSE', 'Incorrect evaluation of conditional directives: ' . $out); $this->set('cond1', TRUE); $this->set('cond2', TRUE); $out = trim(Template::serve('template/layout.htm')); $this->expect($out == 'c1:T,c2:T', 'Conditional directives evaluated correctly: TRUE, TRUE', 'Incorrect evaluation of conditional directives: ' . $out); $this->set('pi_val', $pi = 3.141592654); $money = 63950.25; $this->set('sub', 'sub6.htm'); $this->set('LANGUAGE', 'en'); $out = trim(Template::serve('template/layout.htm')); // PHP 5.3.2 inserts a line feed at end of translation $this->expect($out == "<h3>I love Fat-Free!</h3>\n" . "<p>Today is " . ICU::format('{0,date}', array(time())) . "</p>\n" . "<p>The quick brown fox jumps over the lazy dog.</p>\n" . "<p>" . ICU::format('{0,number}', array($pi)) . "</p>\n" . "<p>" . ICU::format('{0,number,currency}', array($money)) . "</p>", 'English locale (i18n)', 'English locale mangled: ' . $out); $this->set('sub', 'sub6.htm'); $this->set('LANGUAGE', 'fr-FR'); $out = trim(Template::serve('template/layout.htm')); // PHP 5.3.2 inserts a line feed at end of translation $this->expect($out == "<h3>J'aime Fat-Free!</h3>\n" . "<p>Aujourd'hui, c'est " . ICU::format('{0,date}', array(time())) . "</p>\n" . "<p>Les naïfs ægithales hâtifs pondant à Noël où il gèle sont sûrs d'être déçus et de voir leurs drôles d'œufs abîmés.</p>\n" . "<p>" . ICU::format('{0,number}', array($pi)) . "</p>\n" . "<p>" . ICU::format('{0,number,currency}', array($money)) . "</p>", 'Translated properly to French', 'French translation mangled: ' . $out); $this->set('sub', 'sub6.htm'); $this->set('LANGUAGE', 'es-AR'); $out = trim(Template::serve('template/layout.htm')); // PHP 5.3.2 inserts a line feed at end of translation $this->expect($out == "<h3>Me encanta Fat-Free!</h3>\n" . "<p>Hoy es " . ICU::format('{0,date}', array(time())) . "</p>\n" . "<p>El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, añoraba a su querido cachorro.</p>\n" . "<p>" . ICU::format('{0,number}', array($pi)) . "</p>\n" . "<p>" . ICU::format('{0,number,currency}', array($money)) . "</p>", 'Translated properly to Spanish', 'Spanish translation mangled: ' . $out); $this->set('sub', 'sub6.htm'); $this->set('LANGUAGE', 'de-DE'); $out = trim(Template::serve('template/layout.htm')); // PHP 5.3.2 inserts a line feed at end of translation $this->expect($out == "<h3>Ich liebe Fat-Free!</h3>\n" . "<p>Heute ist " . ICU::format('{0,date}', array(time())) . "</p>\n" . "<p>Im finsteren Jagdschloß am offenen Felsquellwasser patzte der affig-flatterhafte kauzig-höfliche Bäcker über seinem versifften kniffligen Xylophon.</p>\n" . "<p>" . ICU::format('{0,number}', array($pi)) . "</p>\n" . "<p>" . ICU::format('{0,number,currency}', array($money)) . "</p>", 'Translated properly to German', 'German translation mangled: ' . $out); $this->set('LANGUAGE', 'en'); $this->set('sub', 'sub7.htm'); $this->set('array', array('a' => 'apple', 'b' => 'blueberry', 'c' => 'cherry')); $this->set('element', 'b'); $out = trim(Template::serve('template/layout.htm')); $this->expect($out == 'blueberry', 'Array with variable element rendered correctly', 'Array variable element failed to render: ' . var_export($out, TRUE)); $this->set('sub', 'sub8.htm'); $this->set('func', function ($arg1, $arg2) { return 'hello, ' . $arg1 . ' ' . $arg2; }); $this->set('arg1', 'wise'); $this->set('arg2', 'guy'); $out = trim(Template::serve('template/layout.htm')); $this->expect($out == 'hello, wise guy', 'Function with variable arguments rendered correctly', 'Array with variable arguments failed to render: ' . var_export($out, TRUE)); $this->set('benchmark', array_fill(1, 100, array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10))); $time = microtime(TRUE); Template::serve('template/benchmark.htm'); $elapsed = round(microtime(TRUE) - $time, 3); $this->expect($elapsed < 0.05, 'Template containing ' . count($this->get('benchmark')) * 10 . '+ HTML elements/calculations rendered in ' . $elapsed . ' seconds', 'Template rendering too slow on this server: ' . $elapsed . ' seconds'); echo $this->render('basic/results.htm'); }
//Iframe to realtime server } elseif ($basePath == "http://realtime-api.groupdocs.com") { $iframe = 'http://realtime-apps.groupdocs.com/document-viewer/embed/' . $fileGuId; } } if ($iframeType == "annotation") { if ($basePath == "https://api.groupdocs.com/v2.0") { $iframe = 'http://apps.groupdocs.com/document-annotation2/embed/' . $fileGuId; //iframe to dev server } elseif ($basePath == "https://dev-api.groupdocs.com/v2.0") { $iframe = 'http://dev-apps.groupdocs.com/document-annotation2/embed/' . $fileGuId; //iframe to test server } elseif ($basePath == "https://stage-api-groupdocs.dynabic.com/v2.0") { $iframe = 'https://stage-apps-groupdocs.dynabic.com/document-annotation2/Embed/' . $fileGuId; //Iframe to realtime server } elseif ($basePath == "http://realtime-api.groupdocs.com") { $iframe = 'http://realtime-apps.groupdocs.com/document-annotation2/embed/' . $fileGuId; } } $iframe = $signer->signUrl($iframe); //If request was successfull - set url variable for template F3::set('fileId', $fileGuId); F3::set('url', $iframe); } //Process template F3::set('userId', $clientId); F3::set('privateKey', $privateKey); F3::set('width', $width); F3::set('height', $height); echo Template::serve('sample09.htm');
function about() { echo Template::serve('welcome.htm'); }