コード例 #1
0
ファイル: hersteller.php プロジェクト: arnold1119/Hiwi_FasDB
 public function edit()
 {
     // 对herstellername 进行update 首先判断是不是点击了post那个按钮
     // 1、 显示没点击按钮的时候,如果是没点击按钮 那么通过segment(3) 来通过
     //     与结果比对 如果是 那么selected 否则正常显示
     // 2、 如果点击了按钮的时候
     //     ----先要对所进行update的herstellername进行筛选,如果确定是唯一的名字那么
     //         是可以更新 否则不能更新
     if ($this->input->post("update")) {
         $fzh_id = $this->uri->segment(3);
         $fzhg_id = $this->input->post('fzhg_id');
         $land_id = $this->input->post("land_id");
         $herstellername = $this->input->post("herstellername");
         $array = array("herstellername" => $herstellername);
         if (!count($this->hst->h_existiert($array))) {
             $array = array("fzhg_id" => $fzhg_id, "land_id" => $land_id, "herstellername" => $herstellername);
             $index = $this->hst->h_insert($array)[0]["fzh_id"];
             success("hersteller/index/{$index}", "Add Hersteller Success!!");
         } else {
             error("Die hersteller Name schon existiert!!!update fehler!!");
         }
         // p($_POST);die;
     } else {
         $fzh_id = $this->uri->segment(3);
         $array = array('fzh_id' => $fzh_id);
         $data['result'] = $this->hst->hbindung_s($array);
         $data['land'] = $this->land->l_select();
         $data['gruppename'] = $this->hstg->hg_select();
         // p($data);die;
         $this->load->view("hersteller/edit", $data);
     }
 }
コード例 #2
0
ファイル: message.php プロジェクト: qcdcool/book-1
 /**
  * 回复动作
  */
 public function reply_insert()
 {
     $data = array('pid' => $this->input->post('mid'), 'time' => time(), 'content' => $this->input->post('content'));
     $this->message->insert($data);
     success('admin/message/index', '操作成功');
     // print_r($data);
 }
コード例 #3
0
 /**
  * @depends testReadState
  * @group Database
  */
 public function testSaveState()
 {
     info("\tTesting state-save\n");
     $token = str_shuffle("ABCDEF123456789");
     $params = array("cmd" => "write", "data" => '[{"name":"test-case-setting","value":"TEST_CASE_' . $token . '"}]', "id" => 1, "session" => "session", "user" => "user");
     $paramHolder = new AgaviRequestDataHolder();
     $paramHolder->setParameters($params);
     $controller = AgaviContext::getInstance()->getController();
     $container = $controller->createExecutionContainer("AppKit", "Ext.ApplicationState", $paramHolder, "javascript", "write");
     try {
         $result = $container->execute();
         $data = json_decode($result->getContent(), true);
     } catch (Exception $e) {
         $this->fail("An exception was thrown during state write: " . $e->getMessage());
     }
     // Check for success state
     if (@(!$data["success"])) {
         $this->fail("Could not write view state! Your cronk settings may not be saved in icinga-web.");
     }
     // Finally get sure the enry is really set
     $entryFound = false;
     foreach ($data["data"] as $entry) {
         if ($entry["name"] == 'test-case-setting' && $entry["value"] == 'TEST_CASE_' . $token) {
             $entryFound = true;
         }
     }
     if (!$entryFound) {
         $this->fail("Write returned success, but preference could not be found in DB!\n");
     }
     success("\tWriting state succeeded!\n");
 }
コード例 #4
0
ファイル: guilds_model.php プロジェクト: Alexy234/modernaac
 public function createGuild($name, $character)
 {
     $ots = POT::getInstance();
     $ots->connect(POT::DB_MYSQL, connection());
     $player = new OTS_Player();
     $player->load($character);
     $new_guild = new OTS_Guild();
     $new_guild->setCreationData(time());
     $new_guild->setName($name);
     $new_guild->setOwner($player);
     $new_guild->save();
     $new_guild->setCustomField('motd', 'New guild. Leader must edit this text :)');
     $new_guild->setCustomField('creationdata', time());
     $new_guild->setCustomField('world_id', $player->getWorld());
     $ranks = $new_guild->getGuildRanksList();
     $ranks->orderBy('level', POT::ORDER_DESC);
     foreach ($ranks as $rank) {
         if ($rank->getLevel() == 3) {
             $player->setRank($rank);
             $player->save();
         }
     }
     $ide = new IDE();
     $ide->redirect(WEBSITE . "/index.php/guilds/view/" . $new_guild->getId());
     success("{$name} has been created.");
 }
コード例 #5
0
function showxml($result, $num_rows)
{
    if ($num_rows > 0) {
        echo "<node>";
        while ($row = mysql_fetch_array($result)) {
            $staff_id = $row['staff_id'];
            $staff_name = "";
            $sub_result = mysql_query("SELECT firstname,lastname FROM isost_staff where staff_id={$staff_id}");
            $sub_row = mysql_fetch_array($sub_result);
            $staff_name = $sub_row['firstname'] . " " . $sub_row['lastname'];
            echo "<ticket>";
            echo "<tid>" . $row['ticket_id'] . "</tid>";
            echo "<dept_id>" . $row['dept_id'] . "</dept_id>";
            echo "<topic_id>" . $row['topic_id'] . "</topic_id>";
            echo "<priority_id>" . $row['priority_id'] . "</priority_id>";
            echo "<staff>" . $staff_name . "</staff>";
            echo "<email>" . $row['email'] . "</email>";
            echo "<name>" . $row['name'] . "</name>";
            echo "<subject><![CDATA[" . $row['subject'] . "]]></subject>";
            echo "<helptopic>" . $row['helptopic'] . "</helptopic>";
            echo "<status>" . $row['status'] . "</status>";
            echo "<source>" . $row['source'] . "</source>";
            echo "<duedate>" . $row['duedate'] . "</duedate>";
            echo "<created>" . $row['created'] . "</created>";
            echo "<updated>" . $row['updated'] . "</updated>";
            echo "<isoverdue>" . $row['isoverdue'] . "</isoverdue>";
            echo "<ip_address>" . $row['ip_address'] . "</ip_address>";
            echo "</ticket>";
        }
        echo "</node>";
    } else {
        $nodata = 0;
        success($nodata);
    }
}
コード例 #6
0
ファイル: groups.php プロジェクト: unregister/tutupgelas
 public function save_permission()
 {
     $response = array();
     $this->load->model('cpanel/groups_model');
     $this->load->model('dx_auth/permissions');
     if ($this->input->post('group_id', true)) {
         if ($this->input->post('resources', true)) {
             $group_id = (int) $this->input->post('group_id', true);
             $resources = $this->groups_model->get_all_resources();
             $access = $this->input->post('resources', true);
             if (count($access) > 0) {
                 $r_resources = array();
                 foreach ((array) $resources as $val) {
                     $allow = in_array($val['id'], $access) ? true : false;
                     $r_resources[$val['name']] = $allow;
                 }
                 $save = $this->permissions->set_permission_data($group_id, $r_resources);
                 if ($save) {
                     $response['status'] = 1;
                     $response['msg'] = success("Data permission berhasil disimpan");
                 } else {
                     $response['status'] = 0;
                     $response['msg'] = error("Data permission gagal disimpan");
                 }
             }
         } else {
             $response['status'] = 0;
             $response['msg'] = "Silahkan pilih resources";
         }
     } else {
         $response['status'] = 0;
         $response['msg'] = "Silahkan pilih resources";
     }
     $this->output->set_content_type('application/json')->set_output(json_encode($response));
 }
コード例 #7
0
ファイル: AuthController.php プロジェクト: jiujiubaba/laravel
 /**
  * 检查登录是否成功
  *
  * @date   2015-10-09
  * @return [type]     [description]
  */
 public function checkLogin()
 {
     if (!Request::has('username', 'password')) {
         return failure('请输入用户名或密码');
     }
     // $rules = [
     //     'captcha' => 'required|captcha',
     // ];
     // $validator = Validator::make(Request::all(), $rules);
     // if ($validator->fails()) {
     //     return $this->failure('验证码错误');
     // }
     $admin = Admin::where('username', Request::input('username'))->first();
     if (!$admin) {
         return failure('用户不存在');
     }
     if (!Hash::check(Request::input('password'), $admin->password)) {
         return failure('用户名或密码错误');
     }
     $admin->increment('sign_in_cnt');
     $admin->last_sign_in_at = Carbon::now();
     $admin->last_sign_in_ip = Request::getClientIp();
     $admin->save();
     Auth::loginUsingId($admin->user_id);
     return success('登录成功');
 }
コード例 #8
0
ファイル: MarkManager.php プロジェクト: ZuoYouLai/DX_Project
 public function addmarks()
 {
     // 基本接收的内容
     $targetfile = $this->ExcelMethod('Excel');
     $examname = $this->input->post('examname');
     $bz = $this->input->post('bz');
     $belong = $this->input->post('belong');
     $period = $this->input->post('period');
     // 获取第一个工作空间obj对象
     $obj = $this->getExcelObject($targetfile, 1);
     // 校验Excel是否符合要求最基本的:学号  成绩
     $arr = array('学号', '成绩');
     $boool = $this->IsokFirstcolum($obj[0], $arr);
     // 符合要求Excel对象
     if ($boool) {
         // 进行对excel对象进行处理 user_name
         $mm = $this->DoMarkData($obj, $boool, "学号");
         $exam = $this->DoMarkData($obj, $boool, "成绩");
         // 进行对号入座的匹配
         $data = $this->MarkManager->getStuInfos($belong, $period);
         // 合成的对象
         $comdata = $this->iSpecialData($mm, $exam, $data);
         if (!count($comdata)) {
             success('MarkManager/importMarkinfo?belong=' . $belong . '&period=' . $period, '你导入的Excel不符合要求');
         }
         // 进行合格 与 不合格的操作
         $alldata = $this->getMarkDataInfo($comdata);
         $finaldata = array('belong' => $belong, 'period' => $period, 'title' => $examname, 'schoolzone' => $data[0]['school_zone'], 'personcount' => count($data), 'inportmarkTime' => date("Y-m-d H:i:s", time()), 'markBz' => $bz, 'markcomment' => $alldata['average'], 'markInfo' => json_encode($comdata), 'passcount' => count($alldata['pass']), 'nopasscount' => count($alldata['nopass']), 'nopassinfo' => json_encode($alldata['nopass']), 'passinfo' => json_encode($alldata['pass']), 'passpercernt' => count($alldata['pass']) / count($comdata));
         // 插入数据操作
         $this->MarkManager->insertaddmarksData($finaldata);
         $this->markInfo();
     } else {
         success('MarkManager/importMarkinfo?belong=' . $belong . '&period=' . $period, '你导入的Excel不符合要求');
     }
 }
コード例 #9
0
ファイル: command.php プロジェクト: 262877348/Sublime-Text
function update_manual($argv)
{
    $start = time();
    $manual_path = $argv[0];
    $api_url = "http://{$argv[1]}/api";
    $chapter_url_root = "{$api_url}/view/";
    $tpl = file_get_contents("{$manual_path}/public/book.tpl");
    $init = json_decode(make_request($api_url), 1);
    $init = $init['data'];
    foreach ($init as $i => $value) {
        if (!$value['_child']) {
            build_chapter($manual_path, $chapter_url_root, $value['id'], $i . '.' . $value['title'], $value['title'], '');
        } else {
            $parent_dir = $i . '.' . $value['title'];
            substr(PHP_OS, 0, 3) == 'WIN' ? $parent_dir = iconv('UTF-8', 'GB2312', $parent_dir) : '';
            if (!is_dir("{$manual_path}/{$parent_dir}")) {
                $flag = mkdir("{$manual_path}/{$parent_dir}");
            }
            foreach ($value['_child'] as $j => $child) {
                build_chapter($manual_path, $chapter_url_root, $child['id'], "{$i}.{$j} {$child['title']}", $child['title'], $parent_dir);
            }
        }
    }
    $time = time() - $start;
    success("the manual has been generated,it takes {$time} s");
}
コード例 #10
0
ファイル: message.php プロジェクト: qcdcool/book-1
 public function insert()
 {
     $content = $this->input->post('content');
     $data = array('content' => $content, 'time' => time(), 'uid' => 0);
     $this->message->insert($data);
     success('index/message/index', '添加成功');
 }
コード例 #11
0
function showxml($result, $num_rows, $query, $status)
{
    if ($num_rows > 0) {
        $noofopentickets = 0;
        $noofclosedtickets = 0;
        $noofslabreached = 0;
        $nooftransfered = 0;
        echo "<node>";
        while ($row = mysql_fetch_array($result)) {
            $staffid = $row[0];
            if (strlen($status) > 0) {
                if ($status == 'open') {
                    $sql1 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.status='{$status}' and t.staff_id='{$staffid}' {$query}");
                    $row1 = mysql_fetch_row($sql1);
                    $noofopentickets = $row1[0];
                    $sql2 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.isoverdue=1 and t.status='{$status}' and t.staff_id='{$staffid}' {$query}");
                    $row2 = mysql_fetch_row($sql2);
                    $noofslabreached = $row2[0];
                }
                if ($status == 'transfered') {
                    $sql3 = mysql_query("select count(t.ticket_id) from isost_ticket t inner join isost_ticket_note tn on t.ticket_id=tn.ticket_id where t.status='open' and tn.title like 'Dept. Transfer %' and tn.staff_id='{$staffid}' {$query}");
                    $row3 = mysql_fetch_row($sql3);
                    $nooftransfered = $row3[0];
                    $noofopentickets = $row3[0];
                }
                if ($status == 'closed') {
                    $sql4 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.status='{$status}' and t.staff_id='{$staffid}' {$query}");
                    $row4 = mysql_fetch_row($sql4);
                    $noofclosedtickets = $row4[0];
                }
            } else {
                $sql1 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.status='open' and t.staff_id='{$staffid}' {$query}");
                $row1 = mysql_fetch_row($sql1);
                $noofopentickets = $row1[0];
                $sql2 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.isoverdue=1 and t.status='open' and t.staff_id='{$staffid}' {$query}");
                $row2 = mysql_fetch_row($sql2);
                $noofslabreached = $row2[0];
                $sql3 = mysql_query("select count(t.ticket_id) from isost_ticket t inner join isost_ticket_note tn on t.ticket_id=tn.ticket_id where t.status='open' and tn.title like 'Dept. Transfer %' and tn.staff_id='{$staffid}' {$query}");
                $row3 = mysql_fetch_row($sql3);
                $nooftransfered = $row3[0];
                $sql4 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.status='closed' and t.staff_id='{$staffid}' {$query}");
                $row4 = mysql_fetch_row($sql4);
                $noofclosedtickets = $row4[0];
            }
            echo "<staff>";
            echo "<staffid>" . $staffid . "</staffid>";
            echo "<firstname>" . $row[1] . "</firstname>";
            echo "<lastname>" . $row[2] . "</lastname>";
            echo "<openticket>" . $noofopentickets . "</openticket>";
            echo "<closedticket>" . $noofclosedtickets . "</closedticket>";
            echo "<transferedticket>" . $nooftransfered . "</transferedticket>";
            echo "<slabreached>" . $noofslabreached . "</slabreached>";
            echo "</staff>";
        }
        echo "</node>";
    } else {
        $nodata = 0;
        success($nodata);
    }
}
コード例 #12
0
ファイル: wpci_helper.php プロジェクト: asalce/wp-ci
/**
 * Prints the WordPress-standard success and/or failure bar when a message is stored
 * in either of success() or failure().
 */
function success_and_failure()
{
    foreach (array('success' => success(), 'failure' => failure()) as $class => $message) {
        if (is_admin() && $message) {
            ?>
				<div class="updated fade <?php 
            echo $class;
            ?>
" id="message" style="background-color: <?php 
            $class == 'success' ? 'rgb(255, 251, 204)' : '#AB6F74';
            ?>
;">
					<p><?php 
            echo $message;
            ?>
</p></div><br />
			<?php 
        } else {
            if ($message) {
                ?>
				<div class="<?php 
                echo $class;
                ?>
">
					<p><?php 
                echo $message;
                ?>
</p>
				</div>
			<?php 
            }
        }
    }
}
コード例 #13
0
ファイル: resources.php プロジェクト: unregister/tutupgelas
 function add()
 {
     $this->system->add_breadcrumb('Data resources', '_cpanel/admin/resources/data');
     $this->system->add_breadcrumb('Tambah resources');
     if (isset($_POST['save_resources'])) {
         $name = trim($_POST['name']);
         if ($name == '') {
             $data['msg'] = error("Resources name is required");
         } else {
             $is_available = $this->adodb->GetOne("SELECT COUNT(*) FROM sys_resources WHERE `name` = '{$name}'");
             if ($is_available > 0) {
                 $data['msg'] = error("Resources for \"{$name}\" is available on DB. Please use another name");
             } else {
                 $parent_id = (int) $_POST['parent_id'];
                 $insert = $this->adodb->Execute("INSERT INTO sys_resources SET parent_id = '{$parent_id}',`name` = '{$name}'");
                 if ($insert) {
                     $data['msg'] = success("New resources has been saved successfully");
                 }
             }
         }
     }
     $data['resources'] = array_resources();
     $data['module'] = "_cpanel";
     $data['page'] = "layout_add_resources";
     $this->load->view($this->layout_content, $data);
 }
コード例 #14
0
ファイル: fahrzeug.php プロジェクト: arnold1119/Hiwi_FasDB
 public function speicher()
 {
     $data = $this->input->post();
     // p($data);die;
     $fahrzeug['fzh_id'] = $data['fzh_id'];
     $fahrzeug['fahrzeugname'] = trim($data['fahrzeugname']);
     //		var $array = array(
     //			"fahrzeugname" => $fahrzeug['fahrzeugname'],
     //		);
     //		$$this->fahrzeug->exit_id($array);
     $fahrzeug['fzk_id'] = $data['fzk_id'];
     $fahrzeug['baujahr'] = $data['baujahr'];
     $fahrzeug['aenderung'] = $data['aenderung'];
     $fahrzeug['eingabe'] = $data['eingabe'];
     $flag = preg_match('/^\\d\\d\\d\\d$/is', $fahrzeug['baujahr']);
     if ($fahrzeug) {
         if ($flag) {
             $fz_id = $this->fahrzeug->add($fahrzeug);
             $markt['fz_id'] = $fz_id;
             $markt['markt_id'] = $data['markt_id'];
             $this->land->m_array_insert($markt);
             $quelle['fz_id'] = $fz_id;
             $quelle['quelle_id'] = $data['quelle_id'];
             $this->quelle->array_insert($quelle);
             $fas['fz_id'] = $fz_id;
             $fas['fas_id'] = $data['fas_id'];
             $this->fas->array_insert($fas);
             success("fahrzeug/fzginfo/{$fz_id}", "Date update success");
         } else {
             error("Bitte eine richtig formig Baujahr eingaben!Z.B 2016");
         }
     }
 }
コード例 #15
0
function showxml($result, $num_rows, $agency)
{
    if ($num_rows > 0) {
        echo "<node>";
        while ($row = mysql_fetch_array($result)) {
            $pass = encryptpass($row[3]);
            $sasql = "select * from ops_user_group where group_id='1' and username='******'5']}'";
            $saresult = mysql_query($sasql);
            $sacount = mysql_num_rows($saresult);
            $superadmin = 0;
            if ($sacount > 0) {
                $superadmin = 1;
            }
            $sasql = "SELECT * from agency_manager where (prim_manager='{$row['5']}' or sec_manager='{$row['5']}') and agency_index='{$agency}'";
            $saresult = mysql_query($sasql);
            $sacount = mysql_num_rows($saresult);
            if ($superadmin == 0 && $sacount > 0) {
                $superadmin = 1;
            }
            echo "<user>";
            echo "<first_name>" . $row[0] . "</first_name>";
            echo "<last_name>" . $row[1] . "</last_name>";
            echo "<email>" . $row[2] . "</email>";
            echo "<pass>" . $pass . "</pass>";
            echo "<expiry>" . $row[4] . "</expiry>";
            echo "<username>" . $row[5] . "</username>";
            echo "<superadmin>" . $superadmin . "</superadmin>";
            echo "</user>";
        }
        echo "</node>";
    } else {
        $nodata = 0;
        success($nodata);
    }
}
コード例 #16
0
ファイル: services.php プロジェクト: AmidoriA/poon-project
function delete()
{
    $id = $_REQUEST['id'];
    $query = "DELETE FROM customers WHERE id={$id}";
    mysql_query($query) or fail(mysql_error());
    success('delete successful');
}
コード例 #17
0
ファイル: home.php プロジェクト: unregister/tutupgelas
 public function save_inquiry()
 {
     if (isset($_POST['inquiry_send'])) {
         $this->load->library('form_validation');
         $this->form_validation->set_rules('inquiry_name', 'Nama', 'trim|required|xss_clean');
         $this->form_validation->set_rules('inquiry_phone', 'No telepon', 'trim|required|xss_clean');
         $this->form_validation->set_rules('inquiry_location', 'Lokasi', 'trim|required|xss_clean');
         $this->form_validation->set_rules('inquiry_captcha', 'Security code', 'trim|required|xss_clean|captcha_check');
         if ($this->form_validation->run() === FALSE) {
             $msg = error(validation_errors());
             set_msg($msg);
             redirect(_URL);
             exit;
         } else {
             $this->db->set('inquiry_name', $this->input->post('inquiry_name'));
             $this->db->set('inquiry_phone', $this->input->post('inquiry_phone'));
             $this->db->set('inquiry_location', $this->input->post('inquiry_location'));
             $this->db->set('inquiry_services', ucfirst($this->input->post('inquiry_services')));
             $this->db->set('inquiry_message', $this->input->post('inquiry_message'));
             $this->db->set('inquiry_created', 'NOW()', FALSE);
             $insert = $this->db->insert('inquiry');
             if ($insert) {
                 $msg = success("Terimakasih. Inquiry berhasil disimpan");
             } else {
                 $msg = success("Inquiry gagal disimpan. Silahkan ulangi");
             }
             set_msg($msg);
             redirect(_URL);
             exit;
         }
     }
 }
コード例 #18
0
function sendFormAction()
{
    if (empty($_POST['bID'])) {
        return error(t('Invalid form submission (missing bID)'));
    } else {
        $block = Block::getByID($_POST['bID']);
        $blockController = new FormController($block);
        $blockController->noSubmitFormRedirect = true;
        $redirectURL = '';
        // //Handle redirect-on-success...
        if ($blockController->redirectCID > 0) {
            $redirectPage = Page::getByID($blockController->redirectCID);
            if ($redirectPage->cID) {
                $redirectURL = Loader::helper('navigation')->getLinkToCollection($redirectPage, true);
            }
        }
        $blockController->redirectCID = 0;
        //reset this in block controller, otherwise it will exit before returning the data we need!
        try {
            $success = $blockController->action_submit_form($_POST['bID']);
            if ($success != null && $success == false) {
                return error(t('Invalid form submission (invalid block ids)'));
            }
        } catch (Exception $e) {
            return error($e->getMessage());
        }
        $fieldErrors = $blockController->get('errors');
        if (is_array($fieldErrors)) {
            foreach ($fieldErrors as $key => $value) {
                return error($fieldErrors[$key]);
            }
        }
        return success($blockController->thankyouMsg);
    }
}
コード例 #19
0
ファイル: ViewToNewMap.php プロジェクト: rlugojr/nagvis
 public function parse($orig_name)
 {
     global $CORE;
     ob_start();
     if (is_action()) {
         try {
             $name = post('name');
             if (!$name) {
                 throw new FieldInputError('name', l('Please provide a map name.'));
             }
             if (!preg_match(MATCH_MAP_NAME, $name)) {
                 throw new FieldInputError('name', l('This is not a valid map name (need to match [M])', array('M' => MATCH_MAP_NAME)));
             }
             if (count($CORE->getAvailableMaps('/^' . $name . '$/')) > 0) {
                 throw new FieldInputError('name', l('A map with this name already exists.'));
             }
             // Read the old config
             $MAPCFG = new GlobalMapCfg($orig_name);
             $MAPCFG->readMapConfig();
             // Create a new map config
             $NEW = new GlobalMapCfg($name);
             $NEW->createMapConfig();
             foreach ($MAPCFG->getMapObjects() as $object_id => $cfg) {
                 $NEW->addElement($cfg['type'], $cfg, $perm = true, $object_id);
             }
             success(l('The map has been created.'));
             reload(cfg('paths', 'htmlbase') . '/frontend/nagvis-js/index.php?mod=Map&show=' . $name, 1);
         } catch (FieldInputError $e) {
             form_error($e->field, $e->msg);
         } catch (NagVisException $e) {
             form_error(null, $e->message());
         } catch (Exception $e) {
             if (isset($e->msg)) {
                 form_error(null, $e->msg);
             } else {
                 throw $e;
             }
         }
     }
     echo $this->error;
     echo '<div class="simple_form">' . N;
     js_form_start('to_new_map');
     input('name');
     submit(l('Save'));
     focus('name');
     // Keep the view parameters the users has set
     $params = ltrim(req('view_params'), '&');
     if ($params) {
         $parts = explode('&', $params);
         foreach ($parts as $part) {
             list($key, $val) = explode('=', $part);
             hidden($key, $val);
         }
     }
     form_end();
     echo '</div>' . N;
     return ob_get_clean();
 }
コード例 #20
0
ファイル: pf_add_album.php プロジェクト: nikhilm/pixelframe
function init($args)
{
    $name = $args['name'];
    $location = $args['location'];
    //check if album already exists
    $cp = new ConfigReader(PF_CONFIG_FILE);
    $albums = $cp->getChildren("settings/albums");
    if ($albums) {
        foreach ($albums as $album) {
            if ($album['attributes']['name'] == $name) {
                error("Album {$name} already exists!");
                return;
            }
        }
    }
    define("ALBUM_DIR", realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $location));
    //check if it exists
    if (!is_dir(ALBUM_DIR)) {
        error("It seems like the directory {$location} does not exist.");
        return;
    }
    //check if directory writeable
    if (!is_writeable(ALBUM_DIR)) {
        error("Could not create album. Could not write to {$location}." . ALBUM_DIR);
        return;
    }
    //get a list of photos (jpg/png)
    //generate thumbnails
    chdir(ALBUM_DIR);
    //try to make thumbnail directory
    if (!is_dir(PF_THUMBNAIL_DIR)) {
        if (!mkdir(PF_THUMBNAIL_DIR)) {
            error("Could not create thumbnails directory in {$location}");
            return;
        }
    }
    //generate thumbnails
    //it seems glob cannot take multiple patterns
    $pattern = array("*.jpg", "*.jpeg", "*.png");
    foreach ($pattern as $pat) {
        foreach (glob($pat) as $file) {
            if (!makeThumbnail($file, PF_THUMBNAIL_DIR . $file)) {
                error("Could not create thumbnail for image {$file}");
                return;
            }
        }
    }
    //add album to config file
    $cp = new ConfigWriter(PF_CONFIG_FILE);
    $attributes = array("name" => $name, "location" => str_replace($_SERVER['DOCUMENT_ROOT'], "", ALBUM_DIR), "theme" => PF_DEFAULT_THEME);
    $cp->addWithAttributes('settings/albums/album', $attributes, "");
    if (!$cp->close()) {
        error("Could not write to configuration file");
    }
    success("Successfully created album {$name} in {$location}.");
}
コード例 #21
0
 public function getRemindpassword($id)
 {
     $result = $this->repo->remindPassword($id);
     if (!$result['status']) {
         error($result['message']);
         return redirect()->back();
     }
     success($result['message']);
     return redirect($this->objectUrl);
 }
コード例 #22
0
ファイル: showMessage.php プロジェクト: Calcio/CursoPHPBasico
function difineTypeMessage($messageType = MESSAGE_TYPE_ERRO, $message)
{
    if ($messageType == MESSAGE_TYPE_ERRO) {
        return error($message);
    } elseif ($messageType == MESSAGE_TYPE_WARNING) {
        return warning($message);
    } else {
        return success($message);
    }
}
コード例 #23
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $recharge = UserRecharge::find($id);
     if (!$recharge) {
         return failure('数据不存在');
     }
     if ($recharge->fail()) {
         return success('处理成功');
     }
     return failure('处理失败');
 }
コード例 #24
0
ファイル: IndexController.php プロジェクト: shsrain/SimpleCms
 /**
  * 博客留言
  *
  * @return Response
  */
 public function message()
 {
     if (Request::isMethod('post')) {
         $data = ['title' => Request::input('title'), 'detail' => Request::input('detail')];
         Mail::send(['html' => 'email'], $data, function ($message) {
             $message->from('*****@*****.**', 'simpleCms的网站留言')->to('*****@*****.**')->subject(Request::input('title'));
         });
         return success('blog.index');
     }
     return view('blog::simpleblog.Blog.Index.message');
 }
コード例 #25
0
function getGames($lid)
{
    global $dbconn_mysql;
    global $dbconn;
    $array = array();
    $query3 = $dbconn_mysql->prepare("SELECT lm.*, ls.type AS score, ls.score AS type, t.name AS team_home_name, t2.name AS team_away_name\n\t\t\t\t\t\t\tFROM teams t, teams t2, live_match lm\n\t\t\t\t\t\t\tLEFT OUTER JOIN live_scores ls ON (ls.match_id=lm.id AND ls.score='CURRENT')\n\t\t\t\t\t\t\tWHERE lm.game_status!='Canc'\n\t\t\t\t\t\t\tAND lm.team_home_id=t.id\n\t\t\t\t\t\t\tAND lm.team_away_id=t2.id\n\t\t\t\t\t\t\tORDER BY lm.status_type='live' DESC");
    $query3->execute();
    $rows = $query3->fetchAll();
    $array['match_data'] = $row;
    success($array);
}
コード例 #26
0
ファイル: index_place.php プロジェクト: Mr-MYY/mangment
 public function deleting()
 {
     $pid = $this->uri->segment(3);
     $data = array('pid' => $pid);
     if ($this->place->count_place($data) == FALSE) {
         $this->place->del_place($data);
         success('index_place/main', '删除位置成功');
     } else {
         success('index_place/main', '该位置已被使用,无法删除');
     }
 }
コード例 #27
0
function init($args)
{
    $pass = $args['newPassword'];
    $cp = new ConfigWriter(PF_CONFIG_FILE);
    $cp->add("settings/password", md5($pass), TRUE);
    if (!$cp->close()) {
        error("Password not changed. Configuration file could not be opened.");
        return;
    }
    success("Password successfully changed");
}
コード例 #28
0
 /**
  * 保存回复数据.
  *
  * @param Request $request
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function store(Request $request)
 {
     $input = $request->all();
     $reply = $this->replyRepository->getSubscribeReply();
     if ($reply) {
         $this->replyRepository->update($input, $reply->id);
     } else {
         $input['type'] = Reply::TYPE_SUBSCRIBE;
         $this->replyRepository->create($input);
     }
     return success('保存成功');
 }
コード例 #29
0
 public function update()
 {
     $id = Request::input('id');
     $adminBank = AdminBank::find($id);
     if (!$adminBank) {
         return failure('不存在该条记录');
     }
     if (!$adminBank->toggleStatus()) {
         return failure('修改状态失败');
     }
     return success('状态变更成功');
 }
コード例 #30
0
 /**
  * 保存回复数据.
  *
  * @param Request $request
  */
 public function store(Request $request)
 {
     $input = $request->all();
     $reply = $this->replyRepository->getDefaultReply();
     if ($reply) {
         $this->replyRepository->update($input, $reply->id);
     } else {
         $input['type'] = Reply::TYPE_DEFAULT;
         $this->replyRepository->create($input);
     }
     return success('保存成功');
 }