Beispiel #1
1
 /**
  * save and cache a content
  *
  * @param string $process_name  Cached ID to save the content in
  * @param mixed $data the content to cached, can be array or string or anything
  * @param int $time the time when the cache file will axpire
  * @return void
  */
 public function save($process_name, $data, $time = 86400)
 {
     if ($this->type == 'apc') {
         return $this->apc_save($process_name, $data, $time);
     }
     if (!is_writable($this->dir_path)) {
         error_msg('<em>ERROR</em> :  <strong>"cache" folder must be writable.');
     }
     $process_path = $this->process_file($process_name);
     if (file_exists($process_path)) {
         @unlink($process_path);
     }
     $data_for_save = '<?' . 'php' . "\n";
     $data_for_save .= '//Cache file, generated at ' . gmdate('d-m-Y h:i A') . "\n\n";
     $data_for_save .= '//No direct opening' . "\n";
     $data_for_save .= '(!defined("IN_SCRIPT") ? exit("hacking attemp!") : null);' . "\n\n";
     $data_for_save .= '//return false after x time' . "\n";
     $data_for_save .= 'if(time() > ' . (time() + $time) . ') return false;' . "\n\n";
     $data_for_save .= '$data = ' . var_export($data, true) . ";\n\n//end of cache";
     if ($file = @fopen($process_path, 'wb')) {
         fwrite($file, $data_for_save);
         fclose($file);
     }
     return;
 }
Beispiel #2
0
function download($auth_key)
{
    $qm = get_qm();
    $filename = isset($_GET['filename']) ? $_GET['filename'] : '';
    $email = isset($_GET['email']) ? $_GET['email'] : '';
    $title = isset($_GET['title']) ? $_GET['title'] : '';
    $key = isset($_GET['key']) ? $_GET['key'] : '';
    $page = isset($_GET['refer']) ? $_GET['refer'] : '';
    $filename = urldecode($filename);
    //validate
    $wikifile = 'wiki/' . encode($page) . '.txt';
    $source = file_exists($wikifile) ? file_get_contents($wikifile) : '';
    if ($page === '' or !preg_match('/&dl(?:button|link)\\(' . preg_quote($filename, '/') . '(?:,|\\))/', $source)) {
        header('HTTP/1.1 403 Forbidden');
        error_msg('Error : Invalid reference');
        exit;
    }
    if ($key != $auth_key) {
        header('HTTP/1.1 403 Forbidden');
        error_msg('Error : Invalid access');
        exit;
    }
    if ($filename == '') {
        header('HTTP/1.1 404 Not Found');
        error_msg('Error : file does not exists');
        exit;
    } else {
        $fp = fopen($filename, 'rb');
        if ($fp == FALSE) {
            fclose($fp);
            error_msg('Error : file does not exists');
            exit;
        }
    }
    //send mail
    if ($email != '') {
        dl_sendmail($email, $filename, $title);
    }
    //get filename
    $tmparr = explode('?', basename($filename));
    $filebasename = $tmparr[0];
    header("Cache-Control: public");
    header("Pragma: public");
    header("Accept-Ranges: none");
    header("Content-Transfer-Encoding: binary");
    header("Content-Disposition: attachment; filename={$filebasename}");
    header("Content-Type: application/octet-stream; name={$filebasename}");
    fpassthru($fp);
    fclose($fp);
    exit;
}
/**
* My Handy Restaurant
*
* http://www.myhandyrestaurant.org
*
* My Handy Restaurant is a restaurant complete management tool.
* Visit {@link http://www.myhandyrestaurant.org} for more info.
* Copyright (C) 2003-2005 Fabio De Pascale
* 
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* @author		Fabio 'Kilyerd' De Pascale <*****@*****.**>
* @package		MyHandyRestaurant
* @copyright		Copyright 2003-2005, Fabio De Pascale
*/
function driver_apply($driver, $msg)
{
    $debug = _FUNCTION_ . ' - Applying driver ' . $driver . ' - to msgline ' . $msg . ' ' . "\n";
    debug_msg(__FILE__, __LINE__, $debug);
    $driver_function = 'driver_' . $driver;
    if (function_exists($driver_function)) {
        $msg = $driver_function($msg);
    } else {
        echo 'driver not found: ' . $driver . '<br>' . "\n";
        $debug = _FUNCTION_ . ' - driver ' . $driver . ' not found' . "\n";
        error_msg(__FILE__, __LINE__, $debug);
    }
    if (!CONF_DEBUG_PRINT_MARKUP) {
        // cleans all not used markups
        $msg = preg_replace("/{[^}]*}/", "", $msg);
    }
    return $msg;
}
 public function process()
 {
     if (!$this->person->isAuth()) {
         error_msg("This is an impossible condition. How did you get in here?");
         return;
     }
     $subscriber = $this->person->getSubscriber();
     if (empty($subscriber) || !$subscriber->isSubscribed()) {
         $this->tpl->assign('not_subscribed_header', $this->translateTag('l10n_not_sub_header', 'messages'));
         $this->tpl->assign('not_subscribed_1', $this->translateTag('l10n_not_sub_1', 'messages'));
         $this->tpl->assign('not_subscribed_2', $this->translateTag('l10n_not_sub_2', 'messages'));
         $this->tpl->assign('content', $this->tpl->fetch('errors/unsubscribed.tpl'));
         return;
     }
     /* test and handle flags */
     $this->processDBCert();
     try {
         $certList = $this->ca->getCertList($this->showAll);
         /* sort the revoked certificates after the active certificates */
         $revoked = array_filter($certList, array($this, 'revokedFilter'));
         $non_revoked = array_diff_assoc($certList, $revoked);
         $certList = $non_revoked + $revoked;
         $this->tpl->assign('certList', $certList);
         $this->tpl->assign('showAll', $this->showAll);
         $this->tpl->assign('defaultDays', Config::get_config('capi_default_cert_poll_days'));
     } catch (ConfusaGenException $e) {
         Framework::error_output($this->translateMessageTag('downl_err_db') . " " . $e->getMessage());
     }
     /* animate the user to install the root certificate in personal mode,
      * so Thunderbird will fully trust the certs when using them in S/MIME
      */
     if (Config::get_config('cert_product') == PRD_PERSONAL) {
         $this->tpl->assign('ca_certificate', ConfusaConstants::$CAPI_PERSONAL_ROOT_CERT);
     }
     /* coming from browser signing - hint the user to install the cert */
     $browserCertOrderNumber = CS::getSessionKey("browserCert");
     if (isset($browserCertOrderNumber)) {
         CS::deleteSessionKey('browserCert');
         $this->tpl->assign('newBrowserCert', $browserCertOrderNumber);
     }
     $this->tpl->assign('permission', $this->person->mayRequestCertificate());
     $this->tpl->assign('standalone', Config::get_config('ca_mode') === CA_STANDALONE);
     $this->tpl->assign('content', $this->tpl->fetch('download_certificate.tpl'));
 }
Beispiel #5
0
function template_out($template_name, $from_modulname)
{
    global $tpl, $lang_suffix;
    $ret = is_modul_name_aktive($from_modulname);
    if ($ret == 0) {
        error_msg("Dieses Modul wurde vom Administrator deaktiviert.<br>Module has been disabled by the administrator.");
        exit;
    }
    $lang_file = LITO_LANG_PATH . $from_modulname . '/lang_' . $lang_suffix . '.php';
    $tpl->config_load($lang_file);
    $tpl->assign('LITO_NAVIGATION', get_navigation());
    $tpl->assign('LITO_GLOBAL_IMAGE_URL', LITO_GLOBAL_IMAGE_URL);
    $tpl->assign('LITO_IMG_PATH', LITO_IMG_PATH_URL . $from_modulname . "/");
    $tpl->assign('LITO_MAIN_CSS', LITO_MAIN_CSS);
    $tpl->assign('GAME_FOOTER_MSG', get_footer());
    $tpl->assign('LITO_ROOT_PATH_URL', LITO_ROOT_PATH_URL);
    $tpl->assign('LITO_MODUL_PATH_URL', LITO_MODUL_PATH_URL);
    $tpl->assign('LITO_BASE_MODUL_URL', LITO_MODUL_PATH_URL);
    $tpl->display($from_modulname . "/" . $template_name);
}
Beispiel #6
0
$modul_name = "acp_map";
require $_SESSION['litotex_start_acp'] . 'acp/includes/perm.php';
$menu_name = "Karteneditor";
$tpl->assign('menu_name', $menu_name);
if ($action == "main") {
    $result = $db->query("SELECT max(x) as maximum FROM cc" . $n . "_crand ");
    $land = $db->fetch_array($result);
    $tpl->assign('op_map_size', $land['maximum']);
    template_out('map.html', $modul_name);
}
if ($action == "make_map") {
    $size = intval(trim($_POST['x']));
    $elemt_1 = intval(trim($_POST['elem1']));
    $elemt_2 = intval(trim($_POST['elem2']));
    if ($size <= 0) {
        error_msg("Falsche Angabe der Kartengröße (Eingabe:{$size})");
        exit;
    }
    trace_msg("Admin map change drop table", 112);
    $sql = "DROP TABLE IF EXISTS cc" . $n . "_crand";
    $update = $db->query($sql);
    trace_msg("Admin map change create table", 112);
    $sql = "CREATE TABLE cc" . $n . "_crand (crand_id INT( 11 ) NOT NULL AUTO_INCREMENT ,x INT( 5 ) NOT NULL ,y INT( 5 ) NOT NULL ,used TINYINT( 1 ) NOT NULL DEFAULT '0',element_type INT( 2 ) NOT NULL DEFAULT '0',PRIMARY KEY ( crand_id )) ";
    $update = $db->query($sql);
    for ($x = 1; $x <= $size; $x++) {
        for ($y = 1; $y <= $size; $y++) {
            $sql = "insert into cc" . $n . "_crand (x,y,used) VALUES('{$x}','{$y}','0')";
            $update = $db->query($sql);
        }
    }
    trace_msg("Admin map change create Elemet1", 112);
Beispiel #7
0
    header("LOCATION: " . LITO_MODUL_PATH_URL . "acp_news/news.php");
    exit;
}
if ($action == "edit") {
    $news_id = intval($_GET['id']);
    $result_news = $db->query("SELECT * FROM cc" . $n . "_news where news_id ='{$news_id}'");
    $row = $db->fetch_array($result_news);
    $tpl->assign('NEWS_OVER', $row['heading']);
    $tpl->assign('ACTION_SAVE', 'update&id=' . $news_id);
    $tpl->assign('NEWS_TEXT_LANG', $row['text']);
    template_out('news_new.html', $modul_name);
}
if ($action == "update") {
    $news_id = intval($_GET['id']);
    if (empty($_POST['new_news']) || empty($_POST['new_news'])) {
        error_msg($l_emptyfield_error);
    } else {
        $text = mysql_real_escape_string(trim($_POST['new_news']));
        $heading = mysql_real_escape_string(trim($_POST['heading']));
        if ($heading == "") {
            $heading = "no input";
        }
        $date = date("d.m.Y, H:i");
        $sql = "update cc" . $n . "_news set user_id='{$_SESSION['userid']}' ,heading= '{$heading}' ,date='{$date}',text='" . nl2br($text) . "' where news_id ='{$news_id}'";
        $update = $db->query($sql);
    }
    header("LOCATION: " . LITO_MODUL_PATH_URL . "acp_news/news.php");
    exit;
}
if ($action == "activate") {
    $news_id = intval($_GET['id']);
Beispiel #8
0
}
//Prüfen ob die TAN bereits verwendet wurde
$filename = $_SESSION["lisa_path"] . "/" . $_SESSION["settings"]["tan_used.txt"];
$handle = fopen($filename, "r");
$tan_used = false;
while (!feof($handle)) {
    $zeile = trim(fgets($handle, 1024));
    $zeile = str_replace(" ", "", $zeile);
    if ($zeile == $tan) {
        $tan_used = true;
    }
}
fclose($handle);
if ($tan_used) {
    $msg = "Fehler: TAN ist bereits verwendet worden<br>\n\t\t\t\t<form action='index.php' method='POST' >\n\t\t\t\t\t\t<input type='submit' value='zurück'>\n\t\t\t\t</form>";
    error_msg($msg);
}
$_SESSION["tan"] = $tan;
?>
			<p>
			<table>
				<tr>
					<td>
							OK: Die TAN ist korrekt und wurde noch nicht verwendet.
					</td>
				</tr>
				<tr>
					<td align='center'>&nbsp;
						<form action='picture_source.php' method='POST' >
							<input type='submit' value='weiter'>
						</form>
Beispiel #9
0
    }
    $tpl->assign('countries', $countries);
    $grp_av_q = $db->query("SELECT `id`, `name` FROM `cc" . $n . "_user_groups`");
    $grps_av = array();
    $i = 0;
    while ($grp_av = $db->fetch_array($grp_av_q)) {
        $grps_av[$i]['id'] = $grp_av['id'];
        $grps_av[$i]['name'] = $grp_av['name'];
        $i++;
    }
    $tpl->assign('grps', $grps_av);
    template_out('edit.html', $modul_name);
}
if ($action == 'res') {
    if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
        error_msg('ID nicht &uuml;bergeben!');
        exit;
    }
    $countries_q = $db->query("SELECT `islandid`, `name`, `res1`, `res2`, `res3`, `res4` FROM `cc" . $n . "_countries` WHERE `islandid` = '" . $_GET['id'] . "'");
    $countries = array();
    $i = 0;
    $countrie = $db->fetch_array($countries_q);
    $countries[$i]['id'] = $countrie['islandid'];
    $countries[$i]['name'] = $countrie['name'];
    $countries[$i]['res1'] = $countrie['res1'];
    $countries[$i]['res2'] = $countrie['res2'];
    $countries[$i]['res3'] = $countrie['res3'];
    $countries[$i]['res4'] = $countrie['res4'];
    $i++;
    $tpl->assign('countrie', $countries[0]);
    template_out('res.html', $modul_name);
 function _get_file_media_id($file_id, $type = 'voice', $title = '', $introduction = '')
 {
     $fileInfo = M('file')->find($file_id);
     if ($fileInfo) {
         $path = '/Uploads/Download/' . $fileInfo['savepath'] . $fileInfo['savename'];
         if (!$path) {
             $this->error('获取素材失败');
             exit;
         }
         $param['type'] = $type;
         $param['media'] = '@' . realpath(SITE_PATH . $path);
         if ($type == 'video') {
             $param['description']['title'] = $title;
             $param['description']['introduction'] = $introduction;
         }
         $url = 'https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=' . get_access_token();
         $res = post_data($url, $param);
         if (!$res) {
             $this->error('同步失败');
         }
         if (isset($res['errcode']) && $res['errcode'] != 0) {
             $this->error(error_msg($res, '素材上传'));
             exit;
         }
     }
     return $res['media_id'];
 }
Beispiel #11
0
    $required = intval($_POST['required']);
    $b_option = trim($_POST['build_option']);
    $description = trim($_POST['descr']);
    $kurz = get_explore_tabless_name($b_option);
    if ($kurz == "") {
        error_msg("Bitte einen Kurznamen eintragen!");
        exit;
    }
    $ret = if_spalte_exist($kurz, "cc" . $n . "_countries");
    if ($ret == 0) {
        $update = $db->query("ALTER TABLE cc" . $n . "_countries ADD " . $kurz . " INT( 10 ) NOT NULL DEFAULT '0'");
    }
    $update = $db->query("UPDATE cc" . $n . "_explore set tabless='' and race='' where tabless='{$b_option}' and race='{$race}'");
    $update = $db->query("Insert Into cc" . $n . "_explore (description,name,race,tabless,res1,res2,res3,res4,time,points,required,explorePic)VALUES ('{$description}','{$name}','{$race}','{$kurz}','{$gold}','{$stone}','{$oil}','{$exp}','{$buildtime}','{$points}','{$required}','{$explorepic}') ");
    header("LOCATION: edit_explore.php");
}
if ($action == "del") {
    $del_id = intval($_GET['del_id']);
    if ($del_id <= 0) {
        error_msg("Vorgang kann nicht ausgef&uuml;hrt werden!");
        exit;
    }
    // search for old
    $result = $db->query("SELECT tabless,eid FROM cc" . $n . "_explore WHERE eid='" . $del_id . "'");
    $row = $db->fetch_array($result);
    $old_kurz = $row['tabless'];
    if ($old_kurz != '') {
        $update = $db->query("delete from cc" . $n . "_explore where eid='" . $del_id . "'");
    }
    header("LOCATION: edit_explore.php");
}
 function _send_by_openid($openids)
 {
     $openids = wp_explode($openids);
     if (empty($openids)) {
         $this->error('要发送的OpenID值不能为空');
     }
     if (count($openids) < 2) {
         $this->error('OpenID至少需要2个或者2个以上');
     }
     $url = 'https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=' . get_access_token();
     $info = $this->_sucai_media_info();
     $param['touser'] = $openids;
     if ($info['msgtype'] == 'text') {
         $param['text']['content'] = $info['media_id'];
         $param['msgtype'] = $info['msgtype'];
     } else {
         if ($info['msgtype'] == 'mpnews') {
             $param['mpnews']['media_id'] = $info['media_id'];
             $param['msgtype'] = $info['msgtype'];
         } else {
             if ($info['msgtype'] == 'voice') {
                 $param['voice']['media_id'] = $info['media_id'];
                 $param['msgtype'] = $info['msgtype'];
             } else {
                 if ($info['msgtype'] == 'mpvideo') {
                     $param['video']['media_id'] = $info['media_id'];
                     $param['msgtype'] = $info['video'];
                 }
             }
         }
     }
     $param = JSON($param);
     $res = post_data($url, $param);
     if ($res['errcode'] != 0) {
         $this->error(error_msg($res));
     } else {
         return $res['msg_id'];
     }
 }
    function info_msg($message, $type = 'INFO')
    {
        error_log("DB ERROR {$type}: {$message}", 0);
    }
    function debug_msg($message, $type = 'DEBUG')
    {
        error_log("DB ERROR {$type}: {$message}", 0);
    }
}
// Allow better debugging if this is run from command line
if (defined('WP_CLI')) {
    error_msg('Error establishing a database connection');
    if (defined('DB_HOST')) {
        debug_connection();
    } else {
        error_msg('DB_HOST is not defined');
    }
    // Also show errors if WP_DEBUG is enabled
} else {
    send_db_error_headers();
    if (defined('WP_DEBUG') && WP_DEBUG) {
        ?>
        <!DOCTYPE html>
        <html xmlns="http://www.w3.org/1999/xhtml"<?php 
        if (is_rtl()) {
            echo ' dir="rtl"';
        }
        ?>
>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 TODO: link to db installation page in the error msg
 */
 $tableslist = mysql_list_tables($db_common, $link);
 $numtables = mysql_num_rows($tableslist);
 if ($numtables == 0) {
     die(GLOBALMSG_DB_NO_TABLES_ERROR);
 }
 $_SESSION['common_db'] = $db_common;
 start_language();
 $found_accounting_db = true;
 if (!$found_accounting_db) {
     $error_msg = common_header('No accounting db has been found');
     $error_msg .= GLOBALMSG_NO_ACCOUNTING_DB_FOUND . "\n";
     $error_msg .= GLOBALMSG_CONFIGURE_DATABASES . "\n";
     $error_msg .= common_bottom();
     error_msg(__FILE__, __LINE__, 'No accounting db has been found');
     die($error_msg);
 }
 $_SESSION['common_db'] = common_find_first_db($_SESSION['common_db']);
 // unsets all the waiters' _SESSION vars
 unset($_SESSION['catprinted']);
 if ($_SERVER['PHP_SELF'] != $_SESSION['page']) {
     $_SESSION['page'] = $_SERVER['PHP_SELF'];
     unset($_SESSION['orderby']);
     unset($_SESSION['ordersort']);
 }
 if (isset($_GET['mgmt_db_number'])) {
     $_SESSION['common_db'] = $_GET['mgmt_db_number'];
 } elseif (isset($_POST['mgmt_db_number'])) {
     $_SESSION['common_db'] = $_POST['mgmt_db_number'];
 }
Beispiel #15
0
function timecard_html($empfullname, $local_timestamp_in_week)
{
    // Return html of employee's timecard.
    global $show_display_name, $one_week;
    // SQL search parameters for one work week.
    $begin_local_timestamp = work_week_begin($local_timestamp_in_week);
    $end_local_timestamp = $begin_local_timestamp + $one_week;
    // Define helper functions for printing timecard header, footer, and for printing every row.
    function print_header($tc)
    {
        // Print timecard html header.
        global $overtime_week_limit, $timecard_display_running_total;
        $overtime_col = $overtime_week_limit > 0 ? "\n    <th align=\"center\" class=\"ovt\" title=\"Overtime hours\">OT</th>" : '';
        $total_col = $timecard_display_running_total == "yes" ? "\n    <th align=\"center\" class=\"total\" title=\"Running total of regular work hours and overtime to date.\">Total</th>" : '';
        print <<<End_Of_HTML

<table class="misc_items timecard_list" border="0" cellpadding="2" cellspacing="0" style="margin:0 auto;">
  <thead>
  <tr>
    <th align="left">In/Out</th>
    <th align="center">Time</th>
    <th align="center">Date</th>
    <th align="center" class="hrs" title="Regular work hours.">Hrs</th>{$overtime_col}{$total_col}
    <th align="left" class="notes">Notes</th>
  </tr>
  </thead>
  <tbody>
End_Of_HTML;
    }
    function print_row($tc)
    {
        // Configuration variables.
        global $timefmt, $datefmt;
        global $overtime_week_limit, $timecard_list_punch_outs, $timecard_display_hours_minutes;
        global $timecard_hours_include_overtime, $timecard_display_running_total;
        static $print_count = 0;
        if ($tc->in_or_out == 1 || $timecard_list_punch_outs == 'yes') {
            $h_color = htmlentities($tc->row['color']);
            $h_inout = htmlentities($tc->row['inout']);
            $h_time = date($timefmt, $tc->start_time);
            $h_date = date($datefmt, $tc->start_time);
            if ($timecard_display_hours_minutes == "yes") {
                $h_hours = hrs_min($timecard_hours_include_overtime == "yes" ? $tc->hours + $tc->overtime : $tc->hours);
                $h_overtime = hrs_min($tc->overtime);
                $h_total = hrs_min($tc->week_hours + $tc->overtime_hours);
            } else {
                $h_hours = sprintf("%01.02f", $timecard_hours_include_overtime == "yes" ? $tc->hours + $tc->overtime : $tc->hours);
                $h_overtime = sprintf("%01.02f", $tc->overtime);
                $h_total = sprintf("%01.02f", $tc->week_hours + $tc->overtime_hours);
            }
            $h_notes = htmlentities($tc->row['notes']);
            if ($tc->in_or_out != 1) {
                // Don't display hours on "out" records.
                $h_hours = $h_overtime = $h_total = '';
            }
            $row_class = ++$print_count % 2 ? 'odd' : 'even';
            $overtime_col = $overtime_week_limit > 0 ? "\n    <td align=\"right\" class=\"ovt\">{$h_overtime}</td>" : '';
            $total_col = $timecard_display_running_total == "yes" ? "\n    <td align=\"right\" class=\"total\">{$h_total}</td>" : '';
            print <<<End_Of_HTML

  <tr class="display_row {$row_class}">
    <td align="left" style="color:{$h_color}">{$h_inout}</td>
    <td align="right">{$h_time}</td>
    <td align="right">{$h_date}</td>
    <td align="right" class="hrs">{$h_hours}</td>{$overtime_col}{$total_col}
    <td align="left" class="notes">{$h_notes}</td>
  </tr>
End_Of_HTML;
        }
    }
    function print_footer($tc)
    {
        global $timecard_display_running_total, $timecard_hours_include_overtime;
        global $timecard_display_hours_minutes, $overtime_week_limit;
        // Set flag to print paragraph of totals if they're not already obvious.
        $print_totals = $timecard_display_running_total == "yes" || $timecard_hours_include_overtime != "yes" ? true : false;
        $h_total_hours = sprintf("%01.02f", $tc->week_hours + $tc->overtime_hours);
        $h_totals = $print_totals ? "\n<p>Total for week: " . hrs_min($tc->week_hours + $tc->overtime_hours) . " ({$h_total_hours} hours)</p>" : '';
        $h_ovt_total_hours = sprintf("%01.02f", $tc->overtime_hours);
        $h_overtime_totals = $print_totals && $tc->overtime_hours > 0 ? "\n<p>Total overtime: " . hrs_min($tc->overtime_hours) . " ({$h_ovt_total_hours} hours)</p>" : '';
        $h_day_total_hours = sprintf("%01.02f", $tc->today_hours);
        $h_today_hours = $tc->today_hours !== null ? "<p>Total today: " . hrs_min($tc->today_hours) . " ({$h_day_total_hours} hours)</p>" : '';
        if ($timecard_display_running_total != "yes") {
            // Print row of totals
            $total_hours = $timecard_hours_include_overtime == "yes" ? $tc->week_hours + $tc->overtime_hours : $tc->week_hours;
            $h_hours = $timecard_display_hours_minutes == "yes" ? hrs_min($total_hours) : $h_total_hours;
            $overtime_col = $overtime_week_limit > 0 ? "\n    <td align=\"right\" class=\"ovt\">" . ($timecard_display_hours_minutes == "yes" ? hrs_min($tc->overtime_hours) : $h_ovt_total_hours) . "</td>" : '';
            $total_col = $timecard_display_running_total == "yes" ? "\n    <td align=\"right\" class=\"total\">" . ($timecard_display_hours_minutes == "yes" ? hrs_min($tc->week_hours + $tc->overtime_hours) : $h_total_hours) . "</td>" : '';
            print <<<End_Of_HTML
  <tr class="total_row">
    <td align="left"></td>
    <td align="right"></td>
    <td align="right"></td>
    <td align="right" class="hrs">{$h_hours}</td>{$overtime_col}{$total_col}
    <td align="left" class="notes"></td>
  </tr>
End_Of_HTML;
        }
        print <<<End_Of_HTML
  </tbody>
</table>
End_Of_HTML;
        if ($timecard_display_running_total == "yes" || $timecard_hours_include_overtime != "yes" || $h_today_hours) {
            // Add totals text if totals are not already displayed or if summing the hours column is confusing.
            print <<<End_Of_HTML

<div class="totals">
{$h_today_hours}{$h_totals}{$h_overtime_totals}
</div>

End_Of_HTML;
        }
    }
    // End of helper function definitions.
    // Print timecard page header.
    $h_name_header = htmlentities($show_display_name == 'yes' ? get_employee_name($empfullname) : $empfullname);
    $begin_date = date('l F j, Y', $begin_local_timestamp);
    print <<<End_Of_HTML

<div class="timecard">
<h2>Timecard</h2>
<h3>{$h_name_header}</h3>
<h4>Week beginning {$begin_date}</h4>
End_Of_HTML;
    // Print timecard.
    $tc = new Timecard($empfullname, $begin_local_timestamp, $end_local_timestamp);
    list($row_count, $total_hours, $overtime_hours, $today_hours) = $tc->walk(print_header, print_row, print_footer);
    if ($row_count <= 0) {
        print error_msg("No records were found.");
    }
    // Print timecard page footer.
    print <<<End_Of_HTML
</div> <!-- timecard -->

End_Of_HTML;
}
            }
        }
        # End of message
        $message .= "------------------\r\n";
        # Send out the email
        #
        if (mail($post['recipient'], $subject, $message, "From: " . $post['email'] . "\r\nReply-To: " . $post['email'] . "\r\nX-Mailer: PHP FormMail")) {
            if (!empty($post['redirect'])) {
                header('Location: ' . $post['redirect']);
            } else {
                echo "<html>\r\n";
                echo "\t<head>\r\n";
                echo "\t\t<title>Thank you</title>\r\n";
                echo "\t\t<style type=\"text/css\">* {font-family: \"Verdana\", \"Arial\", \"Helvetica\", monospace;}</style>\r\n";
                echo "\t</head>\r\n";
                echo "\t<body>\r\n";
                echo "\t\t<p>Thank you for filling out the form.</p>\r\n\t\t<p><small>&laquo; <a href=\"javascript: history.back();\">go back</a></small></p>\r\n";
                echo "\t</body>\r\n";
                echo "</html>\r\n";
            }
        } else {
            error_msg("There was an unknown error while sending email.");
        }
    } else {
        error_msg("This domain is unauthorized to use this program.");
    }
} else {
    error_msg("Invalid request method used.");
}
#
########################################################################
function print_orders($sourceid)
{
    /*
    name:
    print_orders($sourceid)
    returns:
    0 - no error
    1 - no orders to be printed
    2 - template parsing error
    3 - error setting orders printed
    other - mysql error number
    */
    $sourceid = $_SESSION['sourceid'];
    debug_msg(__FILE__, __LINE__, "BEGIN PRINTING");
    $query = "SELECT * FROM `orders` WHERE `sourceid`='{$sourceid}' AND `printed` IS NULL AND `suspend`='0' ORDER BY dest_id ASC, priority ASC, associated_id ASC, id ASC";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return mysql_errno();
    }
    if (!mysql_num_rows($res)) {
        return ERR_ORDER_NOT_FOUND;
    }
    $newassociated_id = "";
    $tablenum = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "name", $sourceid);
    $tpl_print = new template();
    $output['orders'] = '';
    $msg = "";
    while ($arr = mysql_fetch_array($res)) {
        $oldassociated_id = $newassociated_id;
        $newassociated_id = $arr['associated_id'];
        if (isset($priority)) {
            $oldpriority = $priority;
        } else {
            $oldpriority = 0;
        }
        $priority = $arr['priority'];
        if ($oldassociated_id != "") {
            $olddestid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $oldassociated_id));
            $olddest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $olddestid);
            $olddestname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $olddestid);
        } else {
            $olddestid = 0;
        }
        $destid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $newassociated_id));
        $dest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $destid);
        $destname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $destid);
        $dest_language = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "language", $destid);
        if ($destid != $olddestid || $priority != $oldpriority) {
            if ($destid != $olddestid && $olddestid != "") {
                $tpl_print->assign("date", printer_print_date());
                $tpl_print->assign("gonow", printer_print_gonow($oldpriority, $dest_language));
                $tpl_print->assign("page_cut", printer_print_cut());
                // strips the last newline that has been put
                $output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
                if (table_is_takeaway($sourceid)) {
                    $print_tpl_file = 'ticket_takeaway';
                } else {
                    $print_tpl_file = 'ticket';
                }
                if ($err = $tpl_print->set_print_template_file($olddestid, $print_tpl_file)) {
                    return $err;
                }
                if ($err = $tpl_print->parse()) {
                    $msg = "Error in " . __FUNCTION__ . " - ";
                    $msg .= 'error: ' . $err . "\n";
                    echo nl2br($msg) . "\n";
                    error_msg(__FILE__, __LINE__, $msg);
                    return ERR_PARSING_TEMPLATE;
                }
                $tpl_print->restore_curly();
                $msg = $tpl_print->getOutput();
                $tpl_print->reset_vars();
                $output['orders'] = '';
                $msg = str_replace("'", "", $msg);
                if ($outerr = print_line($olddestid, $msg)) {
                    return $outerr;
                }
            } elseif ($priority != $oldpriority && $oldpriority != "") {
                $tpl_print->assign("date", printer_print_date());
                $tpl_print->assign("gonow", printer_print_gonow($oldpriority, $dest_language));
                $tpl_print->assign("page_cut", printer_print_cut());
                // strips the last newline that has been put
                $output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
                if (table_is_takeaway($sourceid)) {
                    $print_tpl_file = 'ticket_takeaway';
                } else {
                    $print_tpl_file = 'ticket';
                }
                if ($err = $tpl_print->set_print_template_file($destid, $print_tpl_file)) {
                    return $err;
                }
                if ($err = $tpl_print->parse()) {
                    $msg = "Error in " . __FUNCTION__ . " - ";
                    $msg .= 'error: ' . $err . "\n";
                    error_msg(__FILE__, __LINE__, $msg);
                    echo nl2br($msg) . "\n";
                    return ERR_PARSING_TEMPLATE;
                }
                $tpl_print->restore_curly();
                $msg = $tpl_print->getOutput();
                $tpl_print->reset_vars();
                $output['orders'] = '';
                $msg = str_replace("'", "", $msg);
                if ($outerr = print_line($destid, $msg)) {
                    return $outerr;
                }
            }
            if (table_is_takeaway($sourceid)) {
                $takeaway_data = takeaway_get_customer_data($sourceid);
                $output['takeaway'] = ucfirst(lang_get($dest_language, 'PRINTS_TAKEAWAY')) . " - ";
                $output['takeaway'] .= $takeaway_data['takeaway_hour'] . ":" . $takeaway_data['takeaway_minute'] . "\n";
                $output['takeaway'] .= $takeaway_data['takeaway_surname'] . "\n";
                $tpl_print->assign("takeaway", $output['takeaway']);
            }
            $output['table'] = ucfirst(lang_get($dest_language, 'PRINTS_TABLE')) . ": " . $tablenum;
            $tpl_print->assign("table", $output['table']);
            $user = new user($_SESSION['userid']);
            $output['waiter'] = ucfirst(lang_get($dest_language, 'PRINTS_WAITER')) . ": " . $user->data['name'];
            $tpl_print->assign("waiter", $output['waiter']);
            $output['priority'] = ucfirst(lang_get($dest_language, 'PRINTS_PRIORITY')) . ": " . $priority . "\n";
            $tpl_print->assign("priority", $output['priority']);
            $output['people'] = ucfirst(lang_get($dest_language, 'PRINTS_PEOPLE')) . ": " . table_people_number($sourceid) . "\n";
            $tpl_print->assign("people", $output['people']);
            $table = new table($sourceid);
            $table->fetch_data(true);
            if ($cust_id = $table->data['customer']) {
                $cust = new customer($cust_id);
                $output['customer'] = ucfirst(lang_get($dest_language, 'CUSTOMER')) . ": " . $cust->data['surname'] . ' ' . $cust->data['name'];
                $tpl_print->assign("customer_name", $output['customer']);
                $output['customer'] = $cust->data['address'];
                $tpl_print->assign("customer_address", $output['customer']);
                $output['customer'] = $cust->data['zip'];
                $tpl_print->assign("customer_zip_code", $output['customer']);
                $output['customer'] = $cust->data['city'];
                $tpl_print->assign("customer_city", $output['customer']);
                $output['customer'] = ucfirst(lang_get($dest_language, 'VAT_ACCOUNT')) . ": " . $cust->data['vat_account'];
                $tpl_print->assign("customer_vat_account", $output['customer']);
            }
        }
        $output['orders'] .= printer_print_row($arr, $destid);
        $printed_orders[] = $arr['id'];
        if ($newassociated_id != $oldassociated_id) {
            // if we're in this function, it means that we changed associated_id id
            // and also that mods have been printed on the same sheet
            if (CONF_PRINT_BARCODES && $arr['dishid'] != MOD_ID) {
                $output['orders'] .= print_barcode($newassociated_id);
            }
        }
        if (CONF_PRINT_BARCODES && $arr['dishid'] != MOD_ID) {
            $output['orders'] .= print_barcode($newassociated_id);
        }
        $tpl_print->assign("orders", $output['orders']);
    }
    $destid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $newassociated_id));
    $dest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $destid);
    $destname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $destid);
    $dest_language = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "language", $destid);
    if (CONF_PRINT_BARCODES) {
        $tpl_print->assign("barcode", print_barcode($newassociated_id));
    }
    $tpl_print->assign("date", printer_print_date());
    $tpl_print->assign("gonow", printer_print_gonow($priority, $dest_language));
    $tpl_print->assign("page_cut", printer_print_cut());
    // strips the last newline that has been put
    $output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
    if (table_is_takeaway($sourceid)) {
        $print_tpl_file = 'ticket_takeaway';
    } else {
        $print_tpl_file = 'ticket';
    }
    if ($err = $tpl_print->set_print_template_file($destid, $print_tpl_file)) {
        return $err;
    }
    if ($err = $tpl_print->parse()) {
        $err_msg = "Error in " . __FUNCTION__ . " - ";
        $err_msg .= 'error: ' . $err . "\n";
        error_msg(__FILE__, __LINE__, $err_msg);
        echo nl2br($err_msg) . "\n";
        return ERR_PARSING_TEMPLATE;
    }
    $tpl_print->restore_curly();
    $msg = $tpl_print->getOutput();
    $tpl_print->reset_vars();
    $output['orders'] = '';
    $msg = str_replace("'", "", $msg);
    if ($outerr = print_line($destid, $msg)) {
        return $outerr;
    }
    foreach ($printed_orders as $val) {
        if ($err = print_set_printed($val)) {
            return $err;
        }
    }
    // there was an error setting orders as printed
    if ($err) {
        return ERR_ORDER_NOT_SET_AS_PRINTED;
    }
    return 0;
}
Beispiel #18
0
function exec_mysql_query($query)
{
    $result = mysql_query($query);
    if ($result === false) {
        error_msg($query);
    }
}
Beispiel #19
0
            $isbool = $db->delete($table, "id=" . $id[$i]);
        }
        if ($isbool !== false) {
            success_msg('删除成功', '?');
        } else {
            error_msg('删除失败', 'back');
        }
    }
}
if ($action == "bj") {
    $id = $_GET['id'];
    $result = $db->query_by_id($table, $id);
    $row = $db->fetch($result);
    $smarty->assign('user', $row);
}
if ($action == "edit") {
    $id = $_POST['id'];
    $state = $_POST['state'];
    $mod_content = "state={$state}";
    $where = 'id=' . $id;
    $isbool = $db->update($table, $mod_content, $where);
    if ($isbool !== false) {
        success_msg('修改成功', '?');
    } else {
        error_msg('修改失败', 'back');
    }
}
$smarty->assign("action", $action);
$smarty->assign("keyword", @$_GET["keyword"]);
$smarty->display('sysadmin/yuyue.html');
require_once 'footer.php';
Beispiel #20
0
    $ftp->mk_dir('template_c/' . $_GET['new']);
    $ftp->copy_req($sourcet, $destt);
    $ftp->copy_req($sourcei, $desti);
    $ftp->copy_req($sourcec, $destc);
    $ftp->disconnect();
    $db->query("INSERT INTO `cc" . $n . "_desigs` (`design_name`, `design_author`, `design_copyright`, `design_author_web`, `design_author_mail`, `design_description`, `aktive`, `alternate_permit`) VALUES ('" . $_GET['new'] . "', '" . $nstd['design_author'] . "', '" . $nstd['design_copyright'] . "', '" . $nstd['design_author_web'] . "', '" . $nstd['design_author_mail'] . "', '" . $nstd['design_description'] . "', 0, 0)");
    $newid = $db->insert_id();
    $navi_db = $db->query("SELECT * FROM `cc" . $n . "_menu_game` WHERE `design_id` = " . $nstd['design_id'] . " ORDER BY `sort_order` ASC");
    while ($element = $db->fetch_array($navi_db)) {
        $db->query("INSERT INTO `cc" . $n . "_menu_game` (`menu_game_name`, `menu_game_link`, `modul_id`, `sort_order`, `menu_art_id`, `ingame`, `optional_parameter`, `design_id`) VALUES ('" . $element['menu_game_name'] . "', '" . $element['menu_game_link'] . "', '" . $element['modul_id'] . "', '" . $element['sort_order'] . "', '" . $element['menu_art_id'] . "', '" . $element['ingame'] . "', '" . $element['optional_parameter'] . "', '" . $newid . "')");
    }
    $action = 'main';
}
if ($action == 'test') {
    if (!isset($_GET['id'])) {
        error_msg('Es wurde keine ID &uuml;bergeben!');
        exit;
    }
    $_GET['id'] = $_GET['id'] * 1;
    $db->query("UPDATE `cc" . $n . "_users` SET `design_id` = '" . $_GET['id'] . "' WHERE `userid` = '" . $_SESSION['userid'] . "'");
    header("Location:" . LITO_ROOT_PATH_URL);
}
if ($action == "main") {
    $themes_q = $db->query("SELECT `design_id`, `design_name`, `design_author`, `design_copyright`, `design_author_mail`, `design_author_web`, `design_description`, `aktive`, `alternate_permit` FROM `cc" . $n . "_desigs`");
    $themes = array();
    $i = 0;
    while ($theme = $db->fetch_array($themes_q)) {
        $themes[$i]['id'] = $theme['design_id'];
        $themes[$i]['name'] = $theme['design_name'];
        $themes[$i]['author'] = $theme['design_author'];
        $themes[$i]['copy'] = $theme['design_copyright'];
    // Validate password
    if (is_valid_password($empfullname, $old_password)) {
        // Check if new password is same as confirm password entry
        if ($new_password === $confirm_password) {
            // Save password.
            if (save_employee_password($empfullname, $new_password)) {
                $_SESSION['authenticated'] = $empfullname;
                exit_next("entry.ajax.php?emp={$u_empfullname}");
            } else {
                print error_msg("Cannot save your new password. " . mysql_error());
            }
        } else {
            print error_msg("Your new password and the confirm password do not match.<br/>Please re-enter and confirm your new password.");
        }
    } else {
        print error_msg("Password is incorrect. Please try again.");
    }
}
// Forgot password form.
if ($forgot_password) {
    print <<<End_Of_HTML

<div id="password_change_form">
<form action="entry.ajax.php" method="get" class="nyroModal">
<table align="center" class="table_border" width="100%" border="0" cellpadding="3" cellspacing="0">
  <tr><th class="rightside_heading" nowrap align="left" colspan="3"><img src="{$TIMECLOCK_URL}/images/icons/lock_edit.png" />&nbsp;&nbsp;&nbsp;Forgot your password?</th></tr>
  <tr><td height="15" colspan="3">&nbsp;</td></tr>
  <tr><th colspan="3" align="left" style="padding-left:32px;">{$name_header}</th></tr>
  <tr><td height="15" colspan="3">&nbsp;</td></tr>
  <tr><td align="left"><p>It is not possible to lookup your old password. You will have to see a supervisor and have them change your password in the administration pages.</p></td></tr>
  <tr><td height="15" colspan="3">&nbsp;</td></tr>
Beispiel #22
0
    if (!isset($_POST['title'])) {
        error_msg('Kein Titel &uuml;bergeben!');
        exit;
    }
    if (!isset($_POST['in_mail'])) {
        $_POST['in_mail'] = 0;
    } else {
        $_POST['in_mail'] = 1;
    }
    $id = $_GET['id'] * 1;
    $db->query("UPDATE `cc" . $n . "_badwords` SET `badword` = '" . $db->escape_string($_POST['title']) . "', `in_mail` = '" . $db->escape_string($_POST['in_mail']) . "' WHERE `badword_id` = '" . $id . "'");
    $action = 'main';
}
if ($action == 'new') {
    if (!isset($_POST['title'])) {
        error_msg('Kein Titel &uuml;bergeben!');
        exit;
    }
    if (!isset($_POST['in_mail'])) {
        $_POST['in_mail'] = 0;
    } else {
        $_POST['in_mail'] = 1;
    }
    $db->query("INSERT INTO `cc" . $n . "_badwords` (`badword`, `in_mail`) VALUES ('" . $db->escape_string($_POST['title']) . "', '" . $db->escape_string($_POST['in_mail']) . "')");
    $action = 'main';
}
if ($action == 'main') {
    $badwords = array();
    $words = $db->query("SELECT `badword_id`, `badword`, `in_mail` FROM `cc" . $n . "_badwords`");
    $i = 0;
    while ($badword = $db->fetch_array($words)) {
Beispiel #23
0
        $file_path = $upload_dir . "/" . $_FILES["file"]["name"];
        $file_type = $_FILES["file"]["type"];
        if (check_ext($file_name) || check_file_type($file_type)) {
            if (file_exists($file_path)) {
                error_msg("Error: {$file_name} already exists!");
            } else {
                move_uploaded_file($tmp_path, $file_path);
                if (!valid_torrent($file_path)) {
                    remove_torrent($file_path);
                    error_msg("Error: Invalid torrent file!");
                } else {
                    output_msg("Uploaded: {$file_name}");
                }
            }
        } else {
            error_msg("Error: Invalid file type!");
        }
    }
}
##### Upload File Validation #####
##### Start-up Check #####
if (check_rtorrent()) {
    if (check_torrent()) {
        display_active_torrent();
        display_inactive_torrent();
    } else {
        output_msg("No torrents found!");
    }
} else {
    if (empty($status)) {
        status_msg("Rtorrent is not started.");
<?php

$Encabezado = "From: " . $_REQUEST['correo'];
$Mensaje = "\n        \nNombre:\t" . $_REQUEST['nombre'] . "\n        \nCompania:\t" . $_REQUEST['compania'] . "\n        \nRubro:\t" . $_REQUEST['rubro'] . "\n        \nCorreo:\t" . $_REQUEST['correo'] . "\n        \nTelefono:\t" . $_REQUEST['telefono'];
$Mensaje = stripslashes($Mensaje);
$Mensaje = strip_tags($Mensaje);
ini_set('sendmail_from', $_REQUEST['correo']);
$Result = mail("*****@*****.**", "Registro de cliente de Gestion Web", $Mensaje, $Encabezado);
if (!$Result) {
    error_msg("Ha ocurrido un error al intentar enviar el correo! Verifique los datos o vuelva a intentarlo nuevamente.");
    return;
}
include_once 'conexion.php';
include_once 'include/util.php';
$query = "\n        INSERT INTO registro (\n            nombre,\n            compania,\n            rubro,\n            correo,\n            telefono\n        )\n        VALUES (\n            '" . verificar_sql($_REQUEST['nombre']) . "',\n            '" . verificar_sql($_REQUEST['compania']) . "',\n            '" . verificar_sql($_REQUEST['rubro']) . "',\n            '" . verificar_sql($_REQUEST['correo']) . "',\n            '" . verificar_sql($_REQUEST['telefono']) . "'\n        )";
if (!mysql_query($query)) {
    sql_error_msg();
    return;
}
print "<h1>Gracias por registrar su sistema!</h1>\n        <p><br>A partir de ahora recibir&aacute; las actualizaciones necesarias para corregir errores y ampliar las funcionalidades del sistema.</p>\n        <p>Muchas gracias por confiar en nosotros la administraci&oacute;n de su negocio.<br><br><br></p>\n        <h2 style='float: right'>El equipo de Gesti&oacute;n Web</h2>";
 function api_notice_increment($url, $data)
 {
     $ch = curl_init();
     $header = "Accept-Charset: utf-8";
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $tmpInfo = curl_exec($ch);
     $errorno = curl_errno($ch);
     if ($errorno) {
         return array('rt' => false, 'errorno' => $errorno);
     } else {
         $js = json_decode($tmpInfo, 1);
         if ($js['errcode'] == '0') {
             return array('rt' => true, 'errorno' => 0);
         } else {
             $this->error(error_msg($js));
         }
     }
 }
 function set_remark()
 {
     $map['uid'] = I('uid', 0, 'intval');
     if (empty($map['uid'])) {
         $this->error('用户信息出错');
     }
     $param['remark'] = I('remark');
     if (empty($param['remark'])) {
         $this->error('备注不能为空');
     }
     $map['token'] = get_token();
     $info = M('public_follow')->where($map)->find();
     if (!$info) {
         $this->error('用户信息出错啦');
     }
     $res = M('public_follow')->where($map)->save($param);
     if ($res !== false) {
         // 同步到微信端
         D('Common/User')->getUserInfo($map['uid'], true);
         if (C('USER_REMARK')) {
             $url = 'https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token=' . get_access_token();
             $param['openid'] = $info['openid'];
             $result = post_data($url, $param);
             if ($res['errcode'] != 0) {
                 $this->error(error_msg($res));
             }
         }
     } else {
         $this->error('保存数据库失败');
     }
     $this->success('设置成功');
 }
Beispiel #27
0
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
////////////////////////////////////////////////////////////////////////////////////
if (!defined("IN_BTIT")) {
    die("non direct access!");
}
if (!defined("IN_ACP")) {
    die("non direct access!");
}
global $STYLEURL;
require load_language("lang_teams.php");
if (!$CURUSER || $CURUSER["edit_users"] != "yes") {
    error_msg("Error", "Sorry you do not have the rights to access this page!");
}
foreach ($_POST as $key => $value) {
    ${$key} = $value;
}
foreach ($_GET as $key => $value) {
    ${$key} = $value;
}
$sure = $_GET['sure'];
$del = $_GET['del'];
$team = htmlspecialchars($_GET['team']);
$edited = (int) $_GET['edited'];
$id = (int) $_GET['id'];
$team_name = $_GET['team_name'];
$team_info = $_GET['team_info'];
$team_image = $_GET['team_image'];
 function _video_download($media_id, $cover_url)
 {
     $savePath = SITE_PATH . '/Uploads/Download/' . time_format(NOW_TIME, 'Y-m-d');
     mkdirs($savePath);
     $ext = 'mp4';
     if (empty($cover_url)) {
         // 获取图片URL
         $url = 'https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=' . get_access_token();
         $param['media_id'] = $media_id;
         $info = post_data($url, $param);
         if (isset($info['errcode']) && $info['errcode'] != 0) {
             $this->error(error_msg($info, '下载视频文件素材失败'));
             exit;
         }
         return $info;
     } else {
         $content = wp_file_get_contents($cover_url);
         // 获取图片扩展名
         $picExt = substr($cover_url, strrpos($cover_url, '=') + 1);
         // $picExt=='jpeg'
         if (empty($picExt)) {
             $picExt = $ext;
         }
         $picName = NOW_TIME . '.' . $picExt;
         $picPath = $savePath . '/' . $picName;
         $res = file_put_contents($picPath, $content);
         if (!$res) {
             $this->error('远程视频文件下载失败');
             exit;
         }
     }
     $cover_id = 0;
     if ($res) {
         // 保存记录,添加到picture表里,获取coverid
         $url = U('File/uploadPicture', array('session_id' => session_id()));
         $_FILES['download'] = array('name' => $picName, 'type' => 'application/octet-stream', 'tmp_name' => $picPath, 'size' => $res, 'error' => 0);
         $File = D('File');
         $file_driver = C('DOWNLOAD_UPLOAD_DRIVER');
         $info = $File->upload($_FILES, C('DOWNLOAD_UPLOAD'), C('DOWNLOAD_UPLOAD_DRIVER'), C("UPLOAD_{$file_driver}_CONFIG"));
         $cover_id = $info['download']['id'];
         unlink($picPath);
     }
     return $cover_id;
 }
Beispiel #29
0
 /**
  * The ChangeShippingInfo function creates XML documents used to send 
  * Order Processing API commands to Google Checkout. This function creates 
  * the XML for the following commands:
  *         <deliver-order>
  *         <add-tracking-data>
  * 
  * @param   $google_order_number    A number, assigned by Google Checkout, 
  *                                      that uniquely identifies an order.
  * @param   $function_name          The type of command that should be
  *                                      created. Valid values for this
  *                                      parameter are "deliver" and
  *                                      "add-tracking-data".
  * @param   $carrier                The carrier handling an order shipment
  * @param   $tracking_number        The tracking number assigned to an
  *                                      order shipment by the shipping carrier
  * @return  XML corresponding to the specified $function_name
  */
 function ChangeShippingInfo($google_order_number, $function_name, $carrier = "", $tracking_number = "")
 {
     $this->_mp_type = 'MISSING_PARAM';
     /*
      * Verify that the necessary parameter values have been provided.
      * The $google_order_number and $function_name parameters are
      * required for all commands. For the <deliver-order> command, the
      * $carrier and $tracking_number parameters are optional; however,
      * if the $carrier is provided, then a $tracking_number must also
      * be provided. For the <add-tracking-data> command, the $carrier
      * and $tracking_number parameters are both required.
      */
     $error_function_name = "ChangeShippingInfo(" . $function_name . ")";
     $this->CheckForError($this->_mp_type, $error_function_name, "google_order_number", $google_order_number);
     // Tracking information is optional for deliver-order,
     // but required for add-tracking-data
     if ($function_name == "deliver-order") {
         // Check for missing tracking number when carrier is set
         $error_type = "MISSING_TRACKING";
         if ($carrier != "" && $tracking_number == "") {
             $this->LogError(error_msg($error_type, $error_function_name), $debug_only_msg = false);
         }
     } elseif ($function_name == "add-tracking-data") {
         $this->CheckForError($this->_mp_type, $error_function_name, "carrier", $carrier);
         $this->CheckForError($this->_mp_type, $error_function_name, "tracking_number", $tracking_number);
     }
     $serializer_options = array("addDecl" => true, "indent" => "     ", "encoding" => "UTF-8", "rootName" => $function_name, "rootAttributes" => array("xmlns" => $this->_checkout_xml_schema, "google-order-number" => $google_order_number), "scalarAsAttributes" => false, "attributesArray" => '_attributes', "contentName" => '_content', "defaultTagName" => 'item', "replaceEntities" => XML_SERIALIZER_ENTITIES_NONE);
     $data = array();
     if ($carrier != "") {
         $data['tracking-data']['carrier'] = $carrier;
         $data['tracking-data']['tracking-number'] = $tracking_number;
     }
     $serializer = new XML_Serializer($serializer_options);
     $rslt = $serializer->serialize($data);
     return $serializer->getSerializedData();
 }
Beispiel #30
0
     echo "\t\t<title>Form Error</title>\r\n";
     echo "\t\t<style type=\"text/css\">* {font-family: \"Verdana\", \"Arial\", \"Helvetica\", monospace;}</style>\r\n";
     echo "\t</head>\r\n";
     echo "\t<body>\r\n";
     echo "\t\t<p>{$error}</p>\r\n\t\t<p><small>&laquo; <a href=\"javascript: history.back();\">go back</a></small></p>\r\n";
     echo "\t</body>\r\n";
     echo "</html>\r\n";
     exit;
 }
 $post = array('required' => $_POST['required'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'address1' => $_POST['address1'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'zip_code' => $_POST['zip_code'], 'credit_card' => $_POST['credit_card'], 'card_holder' => $_POST['card_holder'], 'card_type' => $_POST['card_type'], 'ccv' => $_POST['ccv'], 'exp_date' => $_POST['exp_date'], 'hswd_account_number' => $_POST['hswd_account_number'], 'company_name' => $_POST['company_name'], 'address2' => $_POST['address2'], 'email' => $_POST['email'], 'phone' => $_POST['phone'], 'service_address' => $_POST['service_address'], 'billing_zip_code' => $_POST['billing_zip_code'], 'amount' => $_POST['amount']);
 # Check for missing required fields
 #
 if (!empty($post['required']) && ($list = explode(',', $post['required']))) {
     foreach ($list as $value) {
         if (!empty($value) && empty($_POST["{$value}"])) {
             error_msg("You have left a required field ({$value}) blank.", TRUE);
         }
     }
 }
 $_SESSION['first_name'] = $post['first_name'];
 $_SESSION['last_name'] = $post['last_name'];
 $_SESSION['address1'] = $post['address1'];
 $_SESSION['city'] = $post['city'];
 $_SESSION['state'] = $post['state'];
 $_SESSION['zip_code'] = $post['zip_code'];
 $_SESSION['credit_card'] = $post['credit_card'];
 $_SESSION['card_holder'] = $post['card_holder'];
 $_SESSION['card_type'] = $post['card_type'];
 $_SESSION['ccv'] = $post['ccv'];
 $_SESSION['exp_date'] = $post['exp_date'];
 $_SESSION['hswd_account_number'] = $post['hswd_account_number'];