当前位置: 首页>>代码示例>>PHP>>正文


PHP iPHP::app方法代码示例

本文整理汇总了PHP中iPHP::app方法的典型用法代码示例。如果您正苦于以下问题:PHP iPHP::app方法的具体用法?PHP iPHP::app怎么用?PHP iPHP::app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iPHP的用法示例。


在下文中一共展示了iPHP::app方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: value

 public function value($tag)
 {
     $categoryApp = iPHP::app("category");
     if ($tag['cid']) {
         $category = $categoryApp->category($tag['cid'], false);
         $tag['category'] = $categoryApp->get_lite($category);
     }
     if ($tag['tcid']) {
         $tag_category = $categoryApp->category($tag['tcid'], false);
         $tag['tag_category'] = $categoryApp->get_lite($tag_category);
     }
     $tag['iurl'] = iURL::get('tag', array($tag, $category, $tag_category));
     $tag['url'] or $tag['url'] = $tag['iurl']->href;
     $tag['link'] = '<a href="' . $tag['url'] . '" class="tag" target="_blank">' . $tag['name'] . '</a>';
     if ($category['mode'] && stripos($tag['url'], '.php?') === false) {
         iCMS::set_html_url($tag['iurl']);
     }
     $tag['metadata'] && ($tag['meta'] = json_decode($tag['metadata']));
     $tag['related'] && ($tag['relArray'] = explode(',', $tag['related']));
     $tag['appid'] = iCMS_APP_TAG;
     $tag['pic'] = get_pic($tag['pic']);
     $tag['bpic'] = get_pic($tag['bpic']);
     $tag['mpic'] = get_pic($tag['mpic']);
     $tag['spic'] = get_pic($tag['spic']);
     return $tag;
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:26,代码来源:tag.app.php

示例2: API_list

 public function API_list()
 {
     iPHP::app('user.class', 'static');
     user::get_cookie() or iPHP::code(0, 'iCMS:!login', 0, 'json');
     iPHP::app('favorite.func');
     $array = favorite_list(array('userid' => user::$userid));
     iPHP::json($array);
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:8,代码来源:favorite.app.php

示例3: do_login

 function do_login()
 {
     if ($this->uid) {
         $user = iDB::row("SELECT * FROM `#iCMS@__user` WHERE `uid`='{$this->uid}' LIMIT 1;", ARRAY_A);
         iPHP::app('user.class', 'static');
         user::set_cookie($user['username'], $user['password'], $user);
         $url = iPHP::router(array('/{uid}/', $this->uid), iPHP_ROUTER_REWRITE);
         iPHP::gotourl($url);
     }
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:10,代码来源:user.app.php

示例4: favorite_list

function favorite_list($vars = null)
{
    $maxperpage = isset($vars['row']) ? (int) $vars['row'] : "10";
    $where_sql = "WHERE 1=1 ";
    isset($vars['userid']) && ($where_sql .= " AND `uid`='" . (int) $vars['userid'] . "' ");
    isset($vars['fid']) && ($where_sql .= " AND `fid`='" . (int) $vars['fid'] . "' ");
    isset($vars['mode']) && ($where_sql .= " AND `mode`='" . (int) $vars['mode'] . "'");
    isset($vars['appid']) && ($where_sql .= " AND `appid`='" . (int) $vars['appid'] . "' ");
    $cache_time = isset($vars['time']) ? (int) $vars['time'] : -1;
    $by = $vars['by'] == "ASC" ? "ASC" : "DESC";
    switch ($vars['orderby']) {
        case 'hot':
            $order_sql = " ORDER BY `count` {$by}";
            break;
        default:
            $order_sql = " ORDER BY `id` {$by}";
    }
    $md5 = md5($where_sql . $order_sql);
    $offset = 0;
    if ($vars['page']) {
        $total = iPHP::total($md5, "SELECT count(*) FROM `#iCMS@__favorite` {$where_sql} ");
        iPHP::assign("fav_total", $total);
        $multi = iCMS::page(array('total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:list'), 'nowindex' => $GLOBALS['page']));
        $offset = $multi->offset;
    }
    if ($vars['cache']) {
        $cache_name = iPHP_DEVICE . '/favorite/' . $md5 . "/" . (int) $GLOBALS['page'];
        $resource = iCache::get($cache_name);
    }
    if (empty($resource)) {
        $rs = iDB::all("SELECT * FROM `#iCMS@__favorite` {$where_sql} {$order_sql} LIMIT {$offset},{$maxperpage}");
        iPHP_SQL_DEBUG && iDB::debug(1);
        $resource = array();
        $vars['user'] && iPHP::app('user.class', 'static');
        if ($rs) {
            foreach ($rs as $key => $value) {
                $value['url'] = iPHP::router(array('/favorite/{id}/', $value['id']), iPHP_ROUTER_REWRITE);
                $vars['user'] && ($value['user'] = user::info($value['uid'], $value['nickname']));
                if (isset($vars['loop'])) {
                    $resource[$key] = $value;
                } else {
                    $resource[$value['id']] = $value;
                }
            }
        }
        $vars['cache'] && iCache::set($cache_name, $resource, $cache_time);
    }
    return $resource;
}
开发者ID:sunhk25,项目名称:iCMS,代码行数:49,代码来源:favorite.func.php

示例5: run

 public static function run($app = NULL, $do = NULL, $args = NULL, $prefix = "do_")
 {
     //empty($app) && $app   = $_GET['app']; //单一入口
     if (empty($app)) {
         $fi = iFS::name(__SELF__);
         $app = $fi['name'];
     }
     if (!in_array($app, self::$apps) && iPHP_DEBUG) {
         iPHP::throw404('运行出错!找不到应用程序: <b>' . $app . '</b>', '0001');
     }
     self::$app_path = iPHP_APP_DIR . '/' . $app;
     self::$app_file = self::$app_path . '/' . $app . '.app.php';
     is_file(self::$app_file) or iPHP::throw404('运行出错!找不到文件: <b>' . $app . '.app.php</b>', '0002');
     if ($do === NULL) {
         $do = iPHP_APP;
         $_GET['do'] && ($do = iS::escapeStr($_GET['do']));
     }
     if ($_POST['action']) {
         $do = iS::escapeStr($_POST['action']);
         $prefix = 'ACTION_';
     }
     self::$app_name = $app;
     self::$app_do = $do;
     self::$app_method = $prefix . $do;
     self::$app_tpl = iPHP_APP_DIR . '/' . $app . '/template';
     self::$app_vars = array("MOBILE" => iPHP::$mobile, 'COOKIE_PRE' => iPHP_COOKIE_PRE, 'REFER' => __REF__, 'CONFIG' => self::$config, "APP" => array('NAME' => self::$app_name, 'DO' => self::$app_do, 'METHOD' => self::$app_method));
     iPHP::$iTPL->_iTPL_VARS['SAPI'] .= self::$app_name;
     iPHP::$iTPL->_iTPL_VARS += self::$app_vars;
     self::$app = iPHP::app($app);
     if (self::$app_do && self::$app->methods) {
         in_array(self::$app_do, self::$app->methods) or iPHP::throw404('运行出错! <b>' . self::$app_name . '</b> 类中找不到方法定义: <b>' . self::$app_method . '</b>', '0003');
         $method = self::$app_method;
         $args === null && ($args = self::$app_args);
         if ($args) {
             if ($args === 'object') {
                 return self::$app;
             }
             return call_user_func_array(array(self::$app, $method), (array) $args);
         } else {
             method_exists(self::$app, self::$app_method) or iPHP::throw404('运行出错! <b>' . self::$app_name . '</b> 类中 <b>' . self::$app_method . '</b> 方法不存在', '0004');
             return self::$app->{$method}();
         }
     } else {
         iPHP::throw404('运行出错! <b>' . self::$app_name . '</b> 类中 <b>' . self::$app_method . '</b> 方法不存在', '0005');
     }
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:46,代码来源:iPHP.class.php

示例6: ACTION_add

 public function ACTION_add()
 {
     if (!iCMS::$config['comment']['enable']) {
         iPHP::code(0, 'iCMS:comment:close', 0, 'json');
     }
     iPHP::app('user.class', 'static');
     user::get_cookie() or iPHP::code(0, 'iCMS:!login', 0, 'json');
     $seccode = iS::escapeStr($_POST['seccode']);
     if (iCMS::$config['comment']['seccode']) {
         iPHP::seccode($seccode, true) or iPHP::code(0, 'iCMS:seccode:error', 'seccode', 'json');
     }
     iPHP::app('user.msg.class', 'static');
     $appid = (int) $_POST['appid'];
     $iid = (int) $_POST['iid'];
     $cid = (int) $_POST['cid'];
     $suid = (int) $_POST['suid'];
     $reply_id = (int) $_POST['id'];
     $reply_uid = (int) $_POST['userid'];
     $reply_name = iS::escapeStr($_POST['name']);
     $title = iS::escapeStr($_POST['title']);
     $content = iS::escapeStr($_POST['content']);
     $iid or iPHP::code(0, 'iCMS:article:empty_id', 0, 'json');
     $content or iPHP::code(0, 'iCMS:comment:empty', 0, 'json');
     $fwd = iCMS::filter($content);
     $fwd && iPHP::code(0, 'iCMS:comment:filter', 0, 'json');
     $appid or $appid = iCMS_APP_ARTICLE;
     $addtime = $_SERVER['REQUEST_TIME'];
     $ip = iPHP::getIp();
     $userid = user::$userid;
     $username = user::$nickname;
     $status = iCMS::$config['comment']['examine'] ? '0' : '1';
     $up = '0';
     $down = '0';
     $quote = '0';
     $floor = '0';
     $fields = array('appid', 'cid', 'iid', 'suid', 'title', 'userid', 'username', 'content', 'reply_id', 'reply_uid', 'reply_name', 'addtime', 'status', 'up', 'down', 'ip', 'quote', 'floor');
     $data = compact($fields);
     $id = iDB::insert('comment', $data);
     iDB::query("UPDATE `#iCMS@__article` SET comments=comments+1 WHERE `id` ='{$iid}' limit 1");
     user::update_count($userid, 1, 'comments');
     if (iCMS::$config['comment']['examine']) {
         iPHP::code(0, 'iCMS:comment:examine', $id, 'json');
     }
     iPHP::code(1, 'iCMS:comment:success', $id, 'json');
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:45,代码来源:comment.app.php

示例7: category_array

/**
 * @package iCMS
 * @copyright 2007-2010, iDreamSoft
 * @license http://www.idreamsoft.com iDreamSoft
 * @author coolmoo <idreamsoft@qq.com>
 * @$Id: category.tpl.php 2379 2014-03-19 02:37:47Z coolmoo $
 */
function category_array($vars)
{
    $cid = (int) $vars['cid'];
    return iPHP::app("category")->category($cid, false);
}
开发者ID:sunhk25,项目名称:iCMS,代码行数:12,代码来源:category.func.php

示例8: defined

<?php

/**
* iCMS - i Content Management System
* Copyright (c) 2007-2012 idreamsoft.com iiimon Inc. All rights reserved.
*
* @author coolmoo <idreamsoft@qq.com>
* @site http://www.idreamsoft.com
* @licence http://www.idreamsoft.com/license.php
* @version 6.0.0
* @$Id: tags.app.php 2406 2014-04-28 02:24:46Z coolmoo $
*/
defined('iPHP') or exit('What are you doing?');
iPHP::app('tag.class', 'static');
class tagsApp
{
    public $callback = array();
    function __construct()
    {
        $this->appid = iCMS_APP_TAG;
        $this->id = (int) $_GET['id'];
        $this->tagcategory = iACP::app('tagcategory');
        $this->categoryApp = iACP::app('category', 'all');
    }
    function do_add()
    {
        $this->id && ($rs = iDB::row("SELECT * FROM `#iCMS@__tags` WHERE `id`='{$this->id}' LIMIT 1;", ARRAY_A));
        $rs['metadata'] && ($rs['metadata'] = json_decode($rs['metadata']));
        include iACP::view('tags.add');
    }
    function do_update()
开发者ID:sunhk25,项目名称:iCMS,代码行数:31,代码来源:tags.app.php

示例9: run

 /**
  * 运行应用程序
  * @param string $app 应用程序名称
  * @param string $do 动作名称
  * @return iCMS
  */
 public static function run($app = NULL, $do = NULL, $args = NULL, $prefix = "do_")
 {
     //empty($app) && $app	= $_GET['app']; //单一入口
     if (empty($app)) {
         $fi = iFS::name(__SELF__);
         $app = $fi['name'];
     }
     if (!in_array($app, self::$apps) && iPHP_DEBUG) {
         iPHP::throw404('运行出错!找不到应用程序: <b>' . $app . '</b>', '0001');
     }
     self::$app_path = iPHP_APP_DIR . '/' . $app;
     self::$app_file = self::$app_path . '/' . $app . '.app.php';
     is_file(self::$app_file) or iPHP::throw404('运行出错!找不到文件: <b>' . $app . '.app.php</b>', '0002');
     if ($do === NULL) {
         $do = iPHP_APP;
         $_GET['do'] && ($do = iS::escapeStr($_GET['do']));
     }
     if ($_POST['action']) {
         $do = iS::escapeStr($_POST['action']);
         $prefix = 'ACTION_';
     }
     self::$app_name = $app;
     self::$app_do = $do;
     self::$app_method = $prefix . $do;
     self::$app_tpl = iPHP_APP_DIR . '/' . $app . '/template';
     self::$app_vars = array('VERSION' => iCMS_VER, "MOBILE" => iPHP::$mobile, 'API' => iCMS_API, 'UI' => iCMS_UI, 'UI_URL' => iCMS_UI_URL, 'SAPI' => iCMS_API . '?app=' . self::$app_name, 'COOKIE_PRE' => iPHP_COOKIE_PRE, 'REFER' => __REF__, 'CONFIG' => self::$config, "APP" => array('NAME' => self::$app_name, 'DO' => self::$app_do, 'METHOD' => self::$app_method), "APPID" => array('ARTICLE' => iCMS_APP_ARTICLE, 'CATEGORY' => iCMS_APP_CATEGORY, 'TAG' => iCMS_APP_TAG, 'PUSH' => iCMS_APP_PUSH, 'COMMENT' => iCMS_APP_COMMENT, 'PROP' => ICMS_APP_PROP, 'MESSAGE' => iCMS_APP_MESSAGE, 'FAVORITE' => iCMS_APP_FAVORITE, 'USER' => iCMS_APP_USER));
     define('iCMS_API_URL', iCMS_API . '?app=' . self::$app_name);
     iPHP::$iTPL->_iTPL_VARS = self::$app_vars;
     self::$app = iPHP::app($app);
     if (self::$app_do && self::$app->methods) {
         in_array(self::$app_do, self::$app->methods) or iPHP::throw404('运行出错! <b>' . self::$app_name . '</b> 类中找不到方法定义: <b>' . self::$app_method . '</b>', '0003');
         $method = self::$app_method;
         $args === null && ($args = self::$app_args);
         if ($args) {
             if ($args === 'object') {
                 return self::$app;
             }
             return call_user_func_array(array(self::$app, $method), (array) $args);
         } else {
             method_exists(self::$app, self::$app_method) or iPHP::throw404('运行出错! <b>' . self::$app_name . '</b> 类中 <b>' . self::$app_method . '</b> 方法不存在', '0004');
             return self::$app->{$method}();
         }
     } else {
         iPHP::throw404('运行出错! <b>' . self::$app_name . '</b> 类中 <b>' . self::$app_method . '</b> 方法不存在', '0005');
     }
 }
开发者ID:World3D,项目名称:iCMS,代码行数:52,代码来源:iCMS.class.php

示例10: __article_array

function __article_array($vars, $variable)
{
    $resource = array();
    if ($variable) {
        $articleApp = iPHP::app("article");
        $vars['category_lite'] = true;
        foreach ($variable as $key => $value) {
            $value = $articleApp->value($value, false, $vars);
            if ($value === false) {
                continue;
            }
            if ($vars['page']) {
                $value['page'] = $GLOBALS['page'] ? $GLOBALS['page'] : 1;
                $value['total'] = $total;
            }
            if ($vars['archive'] == "date") {
                $_date = archive_date($value['postime']);
                //var_dump($_date);
                //$_date = get_date($value['postime'],'Ymd');
                unset($resource[$key]);
                $resource[$_date][$key] = $value;
            } else {
                $resource[$key] = $value;
            }
        }
    }
    return $resource;
}
开发者ID:World3D,项目名称:iCMS,代码行数:28,代码来源:article.func.php

示例11: defined

<?php

/**
* iCMS - i Content Management System
* Copyright (c) 2007-2012 idreamsoft.com iiimon Inc. All rights reserved.
*
* @author coolmoo <idreamsoft@qq.com>
* @site http://www.idreamsoft.com
* @licence http://www.idreamsoft.com/license.php
* @version 6.0.0
* @$Id: category.app.php 2406 2014-04-28 02:24:46Z coolmoo $
*/
defined('iPHP') or exit('What are you doing?');
iPHP::app('category.class', 'include');
class categoryApp extends category
{
    protected $category_uri = APP_URI;
    protected $category_furi = APP_FURI;
    protected $category_name = "栏目";
    protected $_app = 'article';
    protected $_app_name = '文章';
    protected $_app_table = 'article';
    protected $_app_cid = 'cid';
    protected $_app_indexTPL = '{iTPL}/category.index.htm';
    protected $_app_listTPL = '{iTPL}/category.list.htm';
    protected $_app_contentTPL = '{iTPL}/article.htm';
    function __construct($appid = null)
    {
        $this->cid = (int) $_GET['cid'];
        $this->appid = iCMS_APP_ARTICLE;
        $appid && ($this->appid = $appid);
开发者ID:World3D,项目名称:iCMS,代码行数:31,代码来源:category.app.php

示例12: defined

<?php

/**
 * @package iCMS
 * @copyright 2007-2010, iDreamSoft
 * @license http://www.idreamsoft.com iDreamSoft
 * @author coolmoo <idreamsoft@qq.com>
 * @$Id: user.tpl.php 1392 2013-05-20 12:28:08Z coolmoo $
 */
defined('iPHP') or exit('What are you doing?');
iPHP::app('user.class', 'static');
function user_data($vars = null)
{
    $vars['uid'] or iPHP::warning('iCMS&#x3a;user&#x3a;data 标签出错! 缺少"uid"属性或"uid"值为空.');
    $uid = $vars['uid'];
    if ($uid == 'me') {
        $uid = 0;
        $auth = user::get_cookie();
        $auth && ($uid = user::$userid);
    }
    if (strpos($uid, ',') === false) {
        $user = (array) user::get($uid);
        if ($vars['data']) {
            $user += (array) user::data($uid);
        }
    } else {
        $uid_array = explode(',', $uid);
        foreach ($uid_array as $key => $value) {
            $user[$key] = (array) user::get($uid);
            if ($vars['data']) {
                $user[$key] += (array) user::data($uid);
开发者ID:sunhk25,项目名称:iCMS,代码行数:31,代码来源:user.func.php

示例13: __tag_array

function __tag_array($vars, $resource)
{
    $tagApp = iPHP::app("tag");
    if ($resource) {
        foreach ($resource as $key => $value) {
            $resource[$key] = $tagApp->value($value);
        }
    }
    return $resource;
}
开发者ID:Junred,项目名称:iCMS,代码行数:10,代码来源:tag.func.php

示例14: openid

 public function openid()
 {
     if (!isset($_GET['sign'])) {
         return;
     }
     $sign = $_GET['sign'];
     $code = $_GET['code'];
     $state = $_GET['state'];
     $platform_map = array('WX' => 1, 'QQ' => 2, 'WB' => 3, 'TB' => 4);
     $class_name = strtoupper($sign);
     $platform = $platform_map[$class_name];
     $bind = $sign;
     if ($platform) {
         iPHP::app('user.open/' . $class_name . '.class', 'static');
         $api = new $class_name();
         $api->appid = iCMS::$config['open'][$class_name]['appid'];
         $api->appkey = iCMS::$config['open'][$class_name]['appkey'];
         $redirect_uri = rtrim(iCMS::$config['open'][$class_name]['redirect'], '/');
         $api->url = user::login_uri($redirect_uri) . 'sign=' . $sign;
         if (isset($_GET['bind']) && $_GET['bind'] == $sign) {
             $api->get_openid();
         } else {
             $api->callback();
         }
         $userid = user::openid($api->openid, $platform);
         if ($userid) {
             $user = user::get($userid, false);
             user::set_cookie($user->username, $user->password, array('uid' => $userid, 'username' => $user->username, 'nickname' => $user->nickname, 'status' => $user->status));
             $api->cleancookie();
             iPHP::gotourl($this->forward);
         } else {
             if (isset($_GET['bind'])) {
                 $user = array();
                 $user['openid'] = $api->openid;
                 $user['platform'] = $platform;
                 $api->cleancookie();
                 iPHP::assign('user', $user);
                 iPHP::view('iCMS://user/login.htm');
             } else {
                 $user = $api->get_user_info();
                 $user['openid'] = $api->openid;
                 $user['platform'] = $platform;
                 iDB::value("SELECT `uid` FROM `#iCMS@__user` where `nickname`='" . $user['nickname'] . "' LIMIT 1") && ($user['nickname'] = $sign . '_' . $user['nickname']);
                 iPHP::assign('user', $user);
                 iPHP::assign('query', compact(array('sign', 'code', 'state', 'bind')));
                 iPHP::view('iCMS://user/register.htm');
             }
             exit;
         }
     }
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:51,代码来源:user.app.php

示例15: delArticle

 function delArticle($id, $uid = '0', $postype = '1')
 {
     $id = (int) $id;
     $id or iPHP::alert("请选择要删除的文章");
     $uid && ($sql = "and `userid`='{$uid}' and `postype`='{$postype}'");
     $art = articleTable::row($id, 'cid,pic,tags', $sql);
     iACP::CP($art['cid'], 'cd', 'alert');
     $frs = articleTable::select_filedata_indexid($id);
     for ($i = 0; $i < count($frs); $i++) {
         if ($frs[$i]) {
             $path = $frs[$i]['path'] . '/' . $frs[$i]['filename'] . '.' . $frs[$i]['ext'];
             iFS::del(iFS::fp($frs[$i]['path'], '+iPATH'));
             $msg .= $this->del_msg($path . ' 文件删除');
         }
     }
     if ($art['tags']) {
         iPHP::app('tag.class', 'static');
         $msg .= tag::del($art['tags']);
     }
     iDB::query("DELETE FROM `#iCMS@__category_map` WHERE `iid` = '{$id}' AND `appid` = '" . $this->appid . "';");
     iDB::query("DELETE FROM `#iCMS@__prop_map` WHERE `iid` = '{$id}' AND `appid` = '" . $this->appid . "' ;");
     articleTable::del_filedata($id, 'indexid');
     $msg .= $this->del_msg('相关文件数据删除');
     articleTable::del_comment($id);
     $msg .= $this->del_msg('评论数据删除');
     articleTable::del($id);
     articleTable::del_data($id);
     $msg .= $this->del_msg('文章数据删除');
     $this->categoryApp->update_count_one($art['cid'], '-');
     $msg .= $this->del_msg('栏目数据更新');
     $msg .= $this->del_msg('删除完成');
     return $msg;
 }
开发者ID:World3D,项目名称:iCMS,代码行数:33,代码来源:article.app.php


注:本文中的iPHP::app方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。