Ejemplo n.º 1
0
 /**
  * load some required files
  */
 function init()
 {
     parent::init();
     $row = $this->member_get_oauth_type($this->type);
     if (!$row->id) {
         exit('access deny');
     }
     $this->oauth_id = $row->id;
     $this->app_key = $row->key1;
     $this->app_secret = $row->key2;
     $this->url = host() . url('oauth/' . $this->type . '/return');
     $files = array(base_path() . 'modules/oauth/libraries/alipay/alipay_core.function.php', base_path() . 'modules/oauth/libraries/alipay/alipay_md5.function.php', base_path() . 'modules/oauth/libraries/alipay/alipay_notify.class.php', base_path() . 'modules/oauth/libraries/alipay/alipay_submit.class.php');
     Load::file($files);
     $alipay_config['partner'] = $this->app_key;
     //安全检验码,以数字和字母组成的32位字符
     $alipay_config['key'] = $this->app_secret;
     $alipay_config['sign_type'] = strtoupper('MD5');
     //字符编码格式 目前支持 gbk 或 utf-8
     $alipay_config['input_charset'] = strtolower('utf-8');
     //ca证书路径地址,用于curl中ssl校验
     //请保证cacert.pem文件在当前文件夹目录中
     $alipay_config['cacert'] = base_path() . 'modules/oauth/libraries/alipay/cacert.pem';
     //访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
     $alipay_config['transport'] = 'http';
     $this->alipay_config = $alipay_config;
 }
Ejemplo n.º 2
0
function sendNotify($userid, $msg, $link, $subject = null)
{
    $umail = "*****@*****.**";
    $ufname = "eDart";
    $ulname = "User";
    $domail = 1;
    //PART I: Write to the database
    $con = mysqli_connect(host(), username(), password(), mainDb());
    $q = "INSERT INTO notify(`usr`,`date`,`message`,`link`) VALUES('" . mysqli_real_escape_string($con, $userid) . "','" . mysqli_real_escape_string($con, time()) . "','" . mysqli_real_escape_string($con, $msg) . "','" . mysqli_real_escape_string($con, $link) . "')";
    //Insert a new row into the author's notifications
    mysqli_query($con, $q);
    //Execute
    $user_call = new User(array("action" => "get", "id" => $userid));
    $user_info = $user_call->run(true);
    if (count($user_info) != 0) {
        $user_info = $user_info[0];
        $umail = $user_info["email"];
        $ufname = ucwords($user_info["fname"]);
        $ulname = ucwords($user_info["lname"]);
        $domail = $user_info["do_mail"];
    }
    $greetings = array("Just wanted to let you know that:<br><br> %s. <br><br>That is all. Have a good rest of your day!", "In case you didn't know: <br><br>%s<br><br> Better go check it out.", "We hope you're having a good day! Just thought you might you want to know:<br><br> %s. <br><br>That is all. Carry on!", "Don't mean to break your flow, but we just thought you might want to know that<br><br> %s. <br><br>If you get the chance, you can check it out back at eDart. For now, live long and prosper!", "Hope your day is going splendidly! Just thought we'd let you know that:<br><br> %s. <br><br>When you have the time, check it out on eDart. Cool. For now, bye.");
    $fullmsg = sprintf($greetings[rand(0, count($greetings) - 1)], $msg);
    if ($subject == null) {
        $subject = $msg;
    }
    //PART II: Send them an email
    if ($domail == 1) {
        sendMail($umail, $ufname, $ulname, $subject, $fullmsg, $link, "View on eDart");
    }
}
Ejemplo n.º 3
0
/**
* 设置及取得上级URL
*/
function return_url($url = null)
{
    if ($url) {
        return \Yii::$app->user->setReturnUrl($url);
    }
    return host() . \Yii::$app->user->returnUrl;
}
Ejemplo n.º 4
0
 public function is_dir()
 {
     $this->_save_path = host() . 'data/' . APP_NAME . '/session';
     if (!is_dir($this->_save_path)) {
         is_create_dir($this->_save_path);
     }
 }
Ejemplo n.º 5
0
function get_absolute_url($relative_url)
{
    if ($relative_url[0] != DIRECTORY_SEPARATOR) {
        return protocol() . host() . cur_directory() . DIRECTORY_SEPARATOR . $relative_url;
    } else {
        return protocol() . host() . $relative_url;
    }
}
Ejemplo n.º 6
0
 private function load()
 {
     $this->_file = preg_replace_callback("/\\@load\\(\\'(.*?)\\'\\)/i", function ($matches) {
         if (isset($matches[1])) {
             $dir = host() . APP_NAME . '/view' . $matches[1];
             $var = file_get_contents($dir);
             return $var;
         }
     }, $this->_file);
 }
Ejemplo n.º 7
0
function plug_deploy($deploy)
{
    $qb = $_SESSION['qb'];
    $USE = $_SESSION['USE'];
    $raed = suj_of_id($deploy);
    $nl = $_GET['nl'] ? $_GET['nl'] : "nl";
    if ($deploy && $USE) {
        //prep
        list($qauth, $subj) = sql('name,suj', 'qda', 'r', 'id="' . $deploy . '"');
        $msg = sql('msg', 'qdm', 'v', 'id="' . $deploy . '"');
        if ($USE == $qauth or auth(5)) {
            $http = host();
            if (!$_POST['dpl']) {
                reqp('mail');
                $qmail = mail_list_tosend();
                $ret .= form("/?read={$deploy}&deploy={$deploy}&nl=nlb", txarea('dpl" maxlength="1000', $qmail, 40, 10) . br() . checkbox("dpf", "ok", "html", 1) . checkbox("multiple", "ok", "each_one", 1) . input2('submit', "send", nms(50), 'popbt'));
            } else {
                $htacc = urlread($deploy);
                $_SESSION['nl'] = $nl;
                //deploy
                if ($_POST['dpf'] == "ok") {
                    $mail_format = "html";
                    $txt = format_txt($msg, $nl, $deploy);
                    $txt = html_entity_decode($txt);
                    $txt = str_replace('href="/', 'href="' . $http . '/', $txt);
                    $msg = lkc("", $http . $htacc, bal("h2", $subj));
                    $msg .= divc("panel justy", $txt);
                } else {
                    $mail_format = "txt";
                    $msg = clean_internaltag($msg);
                    $msg = html_entity_decode($msg);
                }
                $_SESSION['nl'] = "";
                //send
                $sender = sql('mail', 'qdu', 'v', 'name="' . $USE . '"');
                $lstm = str_replace("\n", ",", $_POST['dpl']);
                $lstm = str_replace("\r", ",", $lstm);
                $listmail = explode(",", trim($lstm));
                if ($_POST['multiple'] == "ok" && is_array($listmail)) {
                    $sentto = send_mail_r($listmail, $mail_format, $qb . ' :: ' . $raed, $msg, $sender, $htacc);
                } else {
                    $sentto = $_POST['dpl'];
                    $vm = str_replace(array(",", ";", "\n", " "), ",", $sentto);
                    send_mail($mail_format, $vm, $qb . ' :: ' . $raed, $msg, $sender, $htacc);
                }
                $ret .= lkc("popbt", '/?read=' . $deploy, 'article ' . $deploy . ' sent to: ' . $sentto);
            }
        } else {
            $ret .= btn("popdel", "forbidden");
        }
    }
    //if($_POST['dpl'])return $ret;
    return $ret;
}
Ejemplo n.º 8
0
Archivo: rss.php Proyecto: philum/cms
function plug_rss($hub, $preview)
{
    if ($hub) {
        $_GET['hub'] = $hub;
    }
    if ($preview == '=' or !$preview) {
        $preview = 2;
    }
    if (!$hub) {
        return slct_menus(ses('mn'), '/plug/rss/', '', '', '', 'kv');
    }
    require_once '../prog/lib.php';
    req('pop,art');
    require '../plug/sys.php';
    require '../plug/lib.php';
    $fnod = $_SESSION["qb"] . '_cache';
    $main = msql_read_b('users', $fnod, '', 1);
    $nb_arts = count($main);
    $lastid = lastid('qda');
    $last_art = $main[$lastid];
    $newest = key($main);
    $oldest = array_pop($main);
    $nb_days = round((time() - $oldest[0]) / 86400);
    $cache = 1;
    $f = '../plug/_data/' . $_SESSION["qb"] . '_' . $newest . '_' . $preview . '.xml';
    if (is_file($f) && !$_GET['rebuild'] && $cache) {
        return read_file($f);
    } else {
        $http = host();
        if ($preview) {
            req('tri,pop,art');
        }
        //spe,mod
        $xml .= '<' . '?xml version="1.0" encoding="iso-8859-1"?' . '>' . "\n";
        $xml .= '<rss version="2.0">' . "\n";
        $xml .= '<channel>' . "\n";
        $xml .= bal('title', $_SESSION['qb']) . "\n";
        $xml .= bal('link', $http) . "\n";
        $xml .= bal('description', $nb_arts . ' articles / ' . $nb_days . ' days - preview=' . $preview . ' - static url=' . $http . substr($f, 2)) . "\n";
        $xml .= bal('language', 'fr') . "\n";
        $xml .= bal('lastBuildDate', date("r", $last_art[0])) . "\n";
        if ($main) {
            $xml .= flux_xml($main, $preview) . "\n";
        }
        $xml .= '</channel>' . "\n";
        $xml .= '</rss>' . "\n";
        write_file($f, $xml);
        rss_del_old($newest);
    }
    //eye
    eye('rss');
    return $xml;
}
Ejemplo n.º 9
0
 /**
  * load some required files
  */
 function init()
 {
     parent::init();
     $row = $this->member_get_oauth_type($this->type);
     if (!$row->id) {
         exit('access deny');
     }
     $this->oauth_id = $row->id;
     $this->app_key = $row->key1;
     $this->app_secret = $row->key2;
     $this->url = host() . url('oauth/' . $this->type . '/return');
 }
Ejemplo n.º 10
0
 public function testHost()
 {
     $this->assertEquals(host("http://example.com"), "example.com");
     $this->assertEquals(host("http://EXAMPLE.COM"), "example.com");
     $this->assertEquals(host("http://example.com/"), "example.com");
     $this->assertEquals(host("http://example.com/ "), "example.com");
     $this->assertNotEquals(host("http:// example.com/"), "example.com");
     $this->assertNotEquals(host(" http://example.com/"), "example.com");
     $this->assertNotEquals(host("http ://example.com/"), "example.com");
     $this->assertNotEquals(host("http://example . com/"), "example.com");
     $this->assertNotEquals(host("http://example. com/"), "example.com");
     $this->assertNotEquals(host("http://example .com/"), "example.com");
 }
Ejemplo n.º 11
0
 function __construct($type)
 {
     global $con, $table;
     $con = mysqli_connect(host(), username(), password(), mainDb());
     switch ($type) {
         case ITEM:
             $table = "item";
             break;
         case USER:
             $table = "usr";
             break;
     }
 }
Ejemplo n.º 12
0
function chatxinvit($p, $nm, $to)
{
    $nm = ses('muse');
    $to = ajxg($to);
    $msg = str_replace('_NAME', $nm, helps('chatcall'));
    $url = host() . '/module/chatxml/' . $p;
    if ($to) {
        send_mail_txt($to, $msg, $url, $nm, '');
        return nms(109) . ' ' . nms(79) . 'e';
    } else {
        return nms(114);
    }
}
Ejemplo n.º 13
0
 /**
  * load some required files
  */
 function init()
 {
     parent::init();
     Load::file(base_path() . 'modules/oauth/libraries/sina/SaeTOAuthV2.php');
     $row = $this->member_get_oauth_type($this->type);
     if (!$row->id) {
         exit('access deny');
     }
     $this->oauth_id = $row->id;
     $this->app_key = $row->key1;
     $this->app_secret = $row->key2;
     $this->url = host() . url('oauth/' . $this->type . '/return');
     session_start();
 }
Ejemplo n.º 14
0
function as_siteurl_cookie($action)
{
    global $cookie_value, $cookie_expire, $dir, $plugins_dir, $secure_url;
    //
    //	continue only if action is 'set' and there is a cookie value,
    //	or if action is 'clear'
    //
    $continue = false;
    if ($action === "set" && $cookie_value) {
        $continue = true;
    } elseif ($action === "clear") {
        $cookie_value = " ";
        $cookie_expire = 1;
        $continue = true;
    }
    //
    //	redirect to cookie script - only ever called from wp-login.php
    //
    if ($continue) {
        $path = "/" . content_dir() . "{$plugins_dir}/{$dir}/admin-ssl-cookie.php";
        $file = str_replace("/wp-login.php", "", $_SERVER["SCRIPT_FILENAME"]) . $path;
        as_log("as_siteurl_cookie()\nPath to admin-ssl-cookie.php: {$file}");
        if (file_exists($file)) {
            //
            //	build the URL to redirect to after setting the cookie
            //
            if (redirect_to() && redirect_to() !== "wp-admin/") {
                if (strpos(redirect_to(), "http") === 0) {
                    $redirect = redirect_to();
                } elseif (strpos(redirect_to(), "/") === 0) {
                    $redirect = scheme($use_ssl) . host() . redirect_to();
                } else {
                    $redirect .= $secure_url . "/" . redirect_to();
                }
            } else {
                $redirect = $secure_url . "/wp-login.php";
            }
            //
            //	build the URL to admin-ssl-cookie.php with the cookie data
            //
            $location = rtrim(get_option("siteurl"), "/");
            $location .= "{$path}?name=" . AUTH_COOKIE . "&value={$cookie_value}";
            $location .= "&expire={$cookie_expire}&path=" . COOKIEPATH . "&domain=" . COOKIE_DOMAIN;
            $location .= "&redirect=" . urlencode($redirect);
            as_log("as_siteurl_cookie()\nRedirecting to: {$location}");
            as_redirect($location);
        }
    }
}
Ejemplo n.º 15
0
 /**
  * Overloads default class properties from the options.
  *
  * Any of the provider options can be set here, such as app_id or secret.
  *
  * @param   array   provider options
  * @return  void
  */
 public function __construct(array $options = array())
 {
     if (!$this->name) {
         // Attempt to guess the name from the class name
         $this->name = strtolower(substr(get_class($this), strlen('OAuth2_Provider_')));
     }
     if (empty($options['id'])) {
         throw new Exception('Required option not provided: id');
     }
     $this->client_id = $options['id'];
     isset($options['callback']) and $this->callback = $options['callback'];
     isset($options['secret']) and $this->client_secret = $options['secret'];
     isset($options['scope']) and $this->scope = $options['scope'];
     $this->redirect_uri = host() . \Yii::$app->request->url;
 }
Ejemplo n.º 16
0
 /**
  * load some required files
  */
 function init()
 {
     parent::init();
     $row = $this->member_get_oauth_type($this->type);
     if (!$row->id) {
         exit('access deny');
     }
     $this->oauth_id = $row->id;
     $this->app_key = $row->key1;
     $this->app_secret = $row->key2;
     $url = '/' . url('oauth/' . $this->type . '/return');
     $url = str_replace('//', '/', $url);
     $this->url = host() . $url;
     session_start();
 }
Ejemplo n.º 17
0
 private static function match_class_code($class, $code)
 {
     $connect = mysqli_connect(host(), username(), password(), mainDb());
     if ($code) {
         $return_array = sqlToArray($connect, "SELECT `text` FROM `lookup` WHERE class={$class} AND code={$code}");
         if (count($return_array) != 0) {
             return $return_array[0]["text"];
         } else {
             return NULL;
         }
     } else {
         $return_array = sqlToArray($connect, "SELECT * FROM `lookup` WHERE class={$class}");
         return $return_array;
     }
 }
Ejemplo n.º 18
0
 /**
  * load some required files
  */
 function init()
 {
     parent::init();
     $row = $this->member_get_oauth_type($this->type);
     if (!$row->id) {
         exit('access deny');
     }
     $this->oauth_id = $row->id;
     $this->app_key = $row->key1;
     $this->app_secret = $row->key2;
     $this->url = host() . url('oauth/' . $this->type . '/return');
     Load::file(base_path() . 'modules/oauth/libraries/twitter-async/EpiCurl.php');
     Load::file(base_path() . 'modules/oauth/libraries/twitter-async/EpiOAuth.php');
     Load::file(base_path() . 'modules/oauth/libraries/twitter-async/EpiTwitter.php');
     $this->auth = new \EpiTwitter($this->app_key, $this->app_secret);
 }
Ejemplo n.º 19
0
function env()
{
    if (isset($GLOBALS['SK']['ENV']) and !empty($GLOBALS['SK']['ENV'])) {
        return $GLOBALS['SK']['ENV'];
    }
    $environments = array('development' => array('http://localhost(.*)', '(.*).dev', '(.*).local'), 'production' => array('(.*).com', '(.*).com.br'));
    $env = 'production';
    foreach ($environments as $environment => $patterns) {
        foreach ($patterns as $pattern) {
            if (preg_match('#' . $pattern . '\\z#', host()) or $pattern == host()) {
                $env = $environment;
                break 2;
            }
        }
    }
    return $GLOBALS['SK']['ENV'] = $env;
}
Ejemplo n.º 20
0
function url($params = array())
{
    if (count($params) == 0) {
        return 'http://' . host() . uri();
    } else {
        $url = 'http://' . host() . uri();
        $first = true;
        foreach ($params as $var => $val) {
            if ($first) {
                $url .= '?' . $var . '=' . $val;
                $first = false;
            } else {
                $url .= '&' . $var . '=' . $val;
            }
        }
        return $url;
    }
}
Ejemplo n.º 21
0
 static function controller()
 {
     $value = Classes::get_config('module_host');
     if ($value == 1) {
         $all = DB::all('host');
         if (!$all) {
             return;
         }
         foreach ($all as $v) {
             $url = $v['url'];
             $redirect = $v['redirect'];
             $arr[$url] = $redirect;
         }
         $host = Str::new_replace(host(), array('http://' => '', 'https://' => ''));
         if ($arr[$host]) {
             redirect("http://" . $arr[$host] . $_SERVER['REQUEST_URI']);
         }
     }
 }
Ejemplo n.º 22
0
 public function create(string $data) : string
 {
     $projectKey = PROJECT_CONFIG['key'];
     $algo = CRYPTOGRAPHY_ENCODE_CONFIG['type'];
     if (!isHash($algo)) {
         $algo = 'md5';
     }
     // Proje Anahatarı belirtizme bu veri yerine
     // Proje anahtarı olarak sitenin host adresi
     // eklenecek ek veri kabul edilir.
     if (empty($projectKey)) {
         $additional = hash($algo, host());
     } else {
         $additional = hash($algo, $projectKey);
     }
     // Veri şifreleniyor.
     $data = hash($algo, $data);
     // Veri ve ek yeniden şifreleniyor.
     return hash($algo, $data . $additional);
 }
Ejemplo n.º 23
0
function embed_gallery($f, $id)
{
    $w = currentwidth();
    $h = $w * (3 / 4);
    if (!$f) {
        $cachefile = $id;
    } else {
        $cachefile = $f;
    }
    $fvars = '&servr=' . host() . '/&rot=' . $cachefile . '&clr=' . $_SESSION['clrs'][$_SESSION['prmd']][6];
    $file = 'gallery/cache/' . str_replace("/", "--", $cachefile . '/') . '.php';
    $goto = 'gallery/gal.php?root=' . $f . '&pid=' . $id . '&rebuild==';
    if (!is_file($file)) {
        return lkt('red', $goto, picto('alert'));
    }
    if ($_SESSION['USE']) {
        $add = lkt('', $goto, picto('builders'));
    }
    return embed_flsh('fla/gallery.swf', $w, $h, $fvars) . $add;
}
Ejemplo n.º 24
0
Archivo: plug.php Proyecto: philum/cms
function plug_menu($d, $p, $o, $dr)
{
    if ($dr) {
        $dr = '/' . $dr;
    }
    //$ret.=li(lien('txtsmall','/plug/index',picto('phi')));
    $ret .= popbub('plug', 'plugin', picto('phi2'), 'd', 1);
    //$ret.=llj('','popup_plup___plug_plug*slct',picto('list'));
    $ret .= li(lkc('txtsmall', host() . '/plug/' . $d . ($p ? '/' . $p : '' . ($o ? '/' . $o : '')), picto('reload')));
    $ret .= li(call_plug('txtsmall', 'popup', 'codeview', 'plug' . $dr . '_' . ajx($d), picto('conn')));
    //source
    if (auth(3)) {
        $ret .= msqlink('system', 'program_plugs') . ' ';
    }
    $ret .= plug_hlp($d);
    if (auth(4)) {
        $ret .= lj('', 'popup_editmsql___system/program*plugs_' . ajx($d) . '__1', picto('edit')) . ' ';
        $ret .= lj('', 'popup_editmsql___lang/fr/program*plugs_' . ajx($d) . '__1', picto('flag')) . ' ';
    }
    return mkbub($ret, 'inline', '', 'this.style.zIndex=popz+1;') . divc('admnu', '');
}
Ejemplo n.º 25
0
function prevPath(bool $isPath = true) : string
{
    if (!isset($_SERVER['HTTP_REFERER'])) {
        return false;
    }
    $str = str_replace(sslStatus() . host() . BASE_DIR . indexStatus(), '', $_SERVER['HTTP_REFERER']);
    if (currentLang()) {
        $str = explode("/", $str);
        return $str[1];
    }
    if ($isPath === true) {
        return $str;
    } else {
        $str = explode("/", $str);
        $count = count($str);
        if ($count > 1) {
            return $str[$count - 1];
        }
        return $str[0];
    }
}
Ejemplo n.º 26
0
Archivo: ajax.php Proyecto: philum/cms
     req('admin,spe');
     if ($va) {
         admin_art_sav($id, $va);
     }
     $ret = admin_art_edit($va ? $va : $id);
     break;
     //content
 //content
 case "webpage":
     require 'plug/suggest.php';
     $t = preplink($id);
     $ret = suggest_import($id);
     break;
 case "convhtml":
     req('spe,tri');
     $_GET['urlsrc'] = host() . '/';
     $ret = convhtml_b($id);
     break;
 case "convconn":
     req('pop,tri');
     //wwig
     $ret = format_txt_r(ajx($id, 1), 3, 'test');
     break;
 case "iframe":
     $s = strdeb($res, '-');
     $s = is_numeric($s) ? $s : 720;
     $s = $s > prma('content') ? prma('content') : $s;
     $ret = iframe($id, $s - 20);
     $t = $va;
     break;
     //case("inframe"):$ret=inframe($id,$va,$opt,$optb); break;
Ejemplo n.º 27
0
function toStorage($file, $settings = array())
{
    @($naming = $settings['naming'] ? $settings['naming'] : "%s");
    @($ext = $settings['ext'] ? $settings['ext'] : "");
    @($delete = $settings['delete'] ? $settings['delete'] : false);
    @($subdir = $settings['subdir'] ? $settings['subdir'] : false);
    @($dir = $settings['dir'] ? $settings['dir'] : false);
    $add = 0;
    clearstatcache();
    $dir = rtrim($dir, '/');
    if (host($file)) {
        $tempDirectory = rtrim(`mktemp -d`);
        $content = curl($file);
        if (!is_string($content)) {
            _warn(__FUNCTION__, 'INVALID FILE (URL)!');
            return null;
        }
        $path = parse_url($file, PHP_URL_PATH);
        $name = basename($path);
        if (!$name) {
            $name = mt_rand() . '.tmp';
        }
        $file = "{$tempDirectory}/{$name}";
        file_put_contents($file, $content);
    }
    // $dir - это каталог! $file - это файл!
    if (!is_file($file) or !is_dir($dir)) {
        _warn(__FUNCTION__, 'INVALID FILE OR DIRECTORY!');
        return null;
    }
    $hash = function ($_) {
        return hash('sha256', $_, false);
    };
    //
    $name = file_get_name($file);
    $ext = $ext ? $ext : file_get_ext($file);
    if ($ext) {
        $ext = ".{$ext}";
    }
    //
    if (!$name) {
        $name = mt_rand();
    }
    $name = str_replace(' ', '-', $name);
    if (is_callable($naming)) {
        $name = $naming($name);
    } elseif (is_string($naming)) {
        $name = sprintf($naming, $name);
    }
    $name = preg_replace('~\\W+~', ' ', $name);
    $name = preg_replace('~\\s+~', '-', $name);
    // $name = Normalizer::go($name, 'tr,latinRu,en,hyphen');
    if (!$name) {
        $name = mt_rand();
    }
    //
    $fileHash = $hash(file_get_contents($file));
    if (!$subdir) {
        $subdir = rand_from_string($fileHash) % 1000;
    }
    if (!is_dir($_ = $dir . '/' . $subdir)) {
        mkdir($_, 0755);
    }
    $_ = "/{$subdir}/{$name}{$ext}";
    while (true) {
        if (is_file($dir . $_) and $hash(file_get_contents($dir . $_)) === $fileHash) {
            if ($delete) {
                unlink($file);
            }
            if (isset($tempDirectory)) {
                `rm -rf '{$tempDirectory}'`;
            }
            return $_;
        }
        if (!is_file($dir . $_)) {
            file_put_contents($dir . $_, file_get_contents($file));
            if ($delete) {
                unlink($file);
            }
            if (isset($tempDirectory)) {
                `rm -rf '{$tempDirectory}'`;
            }
            return $_;
        }
        $_ = "/{$subdir}/{$name}-{$add}{$ext}";
        $add += 1;
    }
}
Ejemplo n.º 28
0
// make page as array
$page = explode('/', $page);
// return script path
function host()
{
    $server = $_SERVER['HTTP_HOST'];
    if ($server == 'localhost') {
        return dirname($_SERVER['SCRIPT_NAME']) . '/view';
    } else {
        return 'http://' . $_SERVER['HTTP_HOST'] . '/mvc/view';
    }
}
// get page name
$file = 'controller/' . $page[0] . '.php';
// check if file exist
if (file_exists($file)) {
    // if page exist get the page
    require_once $file;
    new $page[0]();
} elseif ($page[0] == '' || $page[0] == 'home') {
    // if page requested is http://www.name.com get index
    $file = 'controller/index.php';
    require_once $file;
    new index();
    host();
} else {
    // if nothing match get error page
    $file = 'controller/error.php';
    require_once $file;
    new error();
}
Ejemplo n.º 29
0
function urlhost($protocol = null)
{
    return host($protocol) . $_SERVER['SCRIPT_NAME'];
}
Ejemplo n.º 30
0
            $img_url = $_GET['img_url'];
        } else {
            $img_url = '../' . $_GET['img_url'];
        }
    }
    $smarty->assign('img_url', $img_url);
    $smarty->display('goods_show_image.htm');
} elseif ($_REQUEST['act'] == 'edit_goods_name') {
    check_authz_json('goods_manage');
    $goods_id = intval($_POST['id']);
    $goods_name = json_str_iconv(trim($_POST['val']));
    /*add by hg for date 2014-04-25 多个商品命名同步*/
    if (!if_agency()) {
        $goods_id = 0;
    } else {
        $host_arr = host($goods_id);
        if ($host_arr) {
            foreach ($host_arr as $v => $k) {
                $exc->edit("goods_name = '{$goods_name}', last_update=" . gmtime(), $k['goods_id']);
            }
        }
    }
    /*end*/
    if ($exc->edit("goods_name = '{$goods_name}', last_update=" . gmtime(), $goods_id)) {
        clear_cache_files();
        make_json_result(stripslashes($goods_name));
    }
} elseif ($_REQUEST['act'] == 'edit_goods_sn') {
    check_authz_json('goods_manage');
    $goods_id = intval($_POST['id']);
    $goods_sn = json_str_iconv(trim($_POST['val']));