Exemplo n.º 1
0
 public static function canEval($sExtension)
 {
     if (M::PRODUCTION()) {
         return in_array($sExtension, self::$_aEvaledExtensionsProd);
     }
     return in_array($sExtension, self::$_aEvaledExtensionsDev);
 }
 public function __construct($p1)
 {
     $this->prop = $p1;
     echo "Inside instance " . __METHOD__ . "\n";
     parent::__construct();
     M::__construct();
     // allowed
     N::__construct();
     // allowed
     $clName = "M";
     $clName::__construct();
     // allowed
     //      "M"::__construct();     // not allowed
     // can call instance and static methods using both -> and ::
     $this->gi();
     // $this explicitly used (and passed)
     P::gi();
     // $this implicitly used (and passed)
     self::gi();
     // $this implicitly used (and passed)
     $this->gs();
     // call to static method, so no $this passed
     P::gs();
     // call to static method, so no $this passed
     self::gs();
     // call to static method, so no $this passed
 }
Exemplo n.º 3
0
Arquivo: admin.php Projeto: demental/m
 public function doExecApplier()
 {
     $form = new MyQuickForm('applyform', 'POST', M_Office::URL());
     $opts = M::tablesWithPlugin('tag');
     $opts = array_combine($opts, $opts);
     $form->addElement('select', 'table', 'Table', $opts);
     $form->addElement('textarea', 'clause', 'clause', 'rows="4" cols="60"');
     $form->addElement('text', 'tagname', 'tagname');
     $form->addElement('text', 'tagdel', 'tagdel');
     $form->addElement('checkbox', 'distinct', 'distinct');
     $form->addElement('submit', '__submit__', 'Apply');
     $form->addFormRule(array($this, 'checkApplier'));
     if ($form->validate()) {
         @set_time_limit(0);
         ini_set('memory_limit', '1024M');
         $values = $form->exportValues();
         $t = DB_DataObject::factory($values['table']);
         $query = 'SELECT ' . ($values['distinct'] ? 'DISTINCT ' : ' ') . $values['table'] . '.* FROM ' . $values['table'] . ' ' . $values['clause'];
         $t->query($query);
         while ($t->fetch()) {
             if ($values['tagname']) {
                 $t->addTag($values['tagname']);
             }
             if ($values['tagdel']) {
                 $t->removeTag($values['tagdel']);
             }
             $applied++;
         }
         $this->assign('success', 1);
         $this->assign('applied', $applied);
     }
     $this->assign('form', $form);
 }
Exemplo n.º 4
0
 static function getInstance()
 {
     if (self::$con instanceof self) {
         return self::$con;
     } else {
         self::$con = new self();
         return self::$con;
     }
 }
Exemplo n.º 5
0
 public function run()
 {
     $params = M::getRoot();
     //组装参数
     $params["scope"] = "sliderbar";
     //指定定查询范围
     //获取菜单数组
     $navarr = FrontMenu::getChildMenu($params);
     $this->render('navbar', array('nav' => $navarr));
 }
Exemplo n.º 6
0
 /**
  * 连接数据库
  */
 private function conn()
 {
     require dirname(__FILE__) . '/../config.php';
     $db_name = $dbname;
     $db_encode = 'utf8';
     $this->prefix = 'weixin_';
     $this->link = mysql_connect("{$host}:{$port}", $user, $pwd) or die('数据库服务器连接错误:' . mysql_error());
     M::$wlink = $this->link;
     mysql_select_db($db_name) or die('数据库连接错误:' . mysql_error());
     mysql_query("set names '{$db_encode}'");
 }
 /**
  * Returns available diskspace information 
  * 
  * @return array 
  */
 public function getQuotaInfo()
 {
     $stats = M::stats();
     return array(10000000000.0 - $stats['totalSize'], 10000000000.0);
     /*
     return array(
         disk_total_space($this->path)-disk_free_space($this->path),
         disk_free_space($this->path)
         );
     */
 }
Exemplo n.º 8
0
Arquivo: setup.php Projeto: demental/m
 public function setup()
 {
     M_Office_Util::$mainOptions = PEAR::getStaticProperty('m_office', 'options');
     M::addPaths('module', array(APP_ROOT . 'app/_shared/modules/', APP_ROOT . 'app/' . APP_NAME . '/modules/', 'M/Office/modules/'));
     M::addPaths('template', array(OFFICE_TEMPLATES_FOLDER, APP_ROOT . 'app/_shared/templates/', APP_ROOT . 'app/' . APP_NAME . '/templates/'));
     if (Config::getPref('theme')) {
         M::addPaths('template', array(APP_ROOT . 'public/themes/' . Config::getPref('theme') . '/templates/'));
     }
     $tpl = new Mtpl(M::getPaths('template'));
     $tpl->assign('jsdir', SITE_URL . 'js/');
     Mreg::set('tpl', $tpl);
 }
Exemplo n.º 9
0
 public function run()
 {
     //获取
     $params = M::getRoot();
     //组装参数
     $params["scope"] = "sliderbar";
     //指定定查询范围
     //获取菜单数组
     $navarr = FrontMenu::getChildMenu($params);
     $service_arr = array('orders' => '订单管理', 'quos' => '查看报价单', 'returns' => '退货管理');
     $dealer_arr = array('orders' => '订单管理', 'quos' => '管理报价单', 'returns' => '退货管理');
     foreach ($navarr as $key => $val) {
         if (Yii::app()->user->isServicer()) {
             if ($val['name'] != '采购管理') {
                 unset($navarr[$key]);
                 continue;
             }
             foreach ($navarr[$key]['children'] as $k => $v) {
                 if ($v['name'] == $service_arr['orders']) {
                     $data['order'] = $v['name'];
                 } else {
                     if ($v['name'] == $service_arr['quos']) {
                         $data['quo'] = $v['name'];
                     } else {
                         if ($v['name'] == $service_arr['returns']) {
                             $data['return'] = $v['name'];
                         }
                     }
                 }
             }
         }
         if (Yii::app()->user->isDealer()) {
             if ($val['name'] != '销售管理') {
                 unset($navarr[$key]);
                 continue;
             }
             foreach ($navarr[$key]['children'] as $k => $v) {
                 if ($v['name'] == $dealer_arr['orders']) {
                     $data['order'] = $v['name'];
                 } else {
                     if ($v['name'] == $dealer_arr['quos']) {
                         $data['quo'] = $v['name'];
                     } else {
                         if ($v['name'] == $dealer_arr['returns']) {
                             $data['return'] = $v['name'];
                         }
                     }
                 }
             }
         }
     }
     $this->render('topnews', array('mesmenu' => $data));
 }
Exemplo n.º 10
0
function writeinto($info)
{
    $infoarr = json_decode($info, true);
    $flag = new M('flag');
    $count = $flag->find("openid='" . $infoarr['openid'] . "'", '*', 'count');
    $sqlarr = array("nickname" => bin2hex($infoarr['nickname']), "avatar" => $infoarr['headimgurl'], "fakeid" => randStr(), "sex" => $infoarr['sex'], "fromtype" => 'weixin', "datetime" => time(), "flag" => "2");
    if (isset($infoarr['shadyphone'])) {
        $shady = new M('cj_shady');
        $shadyarr = $shady->find("phone=" . $infoarr['shadyphone']);
        if (empty($shadyarr)) {
            $addarr = array('phone' => $infoarr['shadyphone'], 'shady' => $shadyarr['grade']);
            $sqlarr = array_merge($sqlarr, $addarr);
        }
    }
    if ($count) {
        $savve = $flag->update("openid='" . $infoarr['openid'] . "'", $sqlarr);
    }
    if ($savve) {
        echo "ok";
    }
}
Exemplo n.º 11
0
 static function getData($id)
 {
     PDOSql::$pdobj = pdoConnect();
     $d = PDOSql::select("SELECT name, bg_image, subtitle FROM users WHERE id = ?", array($id));
     if (count($d) > 0) {
         $data['name'] = $d[0]['name'];
         $data['bg_image'] = $d[0]['bg_image'];
         $data['subtitle'] = $d[0]['subtitle'];
         return M::cr(true, $data);
     } else {
         return M::cr(false, array('user' => array()), 'No se encontraron datos del usuario');
     }
 }
Exemplo n.º 12
0
 public function testItWorks()
 {
     $mock = M::mock('mindofmicah\\GoodReads\\Curl');
     $mock->shouldReceive('fetchInfo')->once()->andReturn(file_get_contents(__DIR__ . '/stubs/shelves/list.txt'));
     $response = Request::shelves('list', array('id' => 21308373), $mock);
     $this->assertInstanceOf('mindofmicah\\GoodReads\\Response', $response);
     $this->assertInstanceOf('mindofmicah\\GoodReads\\ResponseObj', $response->get('shelves'));
     $this->assertEquals('shelf_list', $response->headers('method'));
     $first_shelf = $response->get('shelves');
     $this->assertInstanceOf('mindofmicah\\GoodReads\\ResponseObj', $first_shelf);
     $first_child = current($first_shelf->child());
     //        print_r($first_child);
     $this->assertEquals('user_shelf', $first_child[0]->getType());
     $this->assertEquals(1, count($response->get('shelves')));
 }
Exemplo n.º 13
0
function send_msgc($msg, $isNotify = true)
{
    global $db;
    if (!is_array($msg)) {
        return;
    }
    $uid = $sql = $mc_sql = array();
    $userService = L::loadClass('UserService', 'user');
    /* @var $userService PW_UserService */
    foreach ($msg as $k => $v) {
        $username = $userService->getUserNameByUserId($v[0]);
        if (!$username) {
            continue;
        }
        M::sendNotice(array($username), array('title' => $v[6], 'content' => $v[7]));
    }
}
Exemplo n.º 14
0
 public function execute($params)
 {
     $db = MDB2::factory(M::getDatabaseDSN());
     $h = $db->dsn['hostspec'];
     $u = $db->dsn['username'];
     $p = $db->dsn['password'];
     $dbn = $db->database_name;
     $mysqlbin = '/usr/bin/env mysql';
     $catbin = '/usr/bin/env cat';
     $file = $this->baseFolder . 'src/tag.sql';
     $sys = "{$catbin} {$file} | {$mysqlbin} --host={$h} --user={$u} --password={$p} {$dbn}";
     system($sys, $return);
     $this->line('Creating tables :');
     $this->line('* tag');
     $this->line('* tag_record');
     $this->line('* tag_history');
 }
Exemplo n.º 15
0
 /**
  * 以某个用户的身份给另一个用户发送短消息
  * @param int $userId 发送者uid
  * @param string $receiver 接受者用户名
  * @param string $subject 标题
  * @param string $content 内容
  * return bool
  */
 function sendMessage($userId, $receiver, $subject, $content)
 {
     global $winddb, $winduid, $windid, $groupid, $_G, $SYSTEM;
     $userService = $this->_getUserService();
     $winddb = $userService->get($userId, true, true);
     $winduid = $winddb['uid'];
     $groupid = $winddb['groupid'];
     $windid = $winddb['username'];
     $groupid == '-1' && ($groupid = $winddb['memberid']);
     if (file_exists(D_P . "data/groupdb/group_{$groupid}.php")) {
         extract(pwCache::getData(S::escapePath(D_P . "data/groupdb/group_{$groupid}.php", false)));
     } else {
         extract(pwCache::getData(D_P . 'data/groupdb/group_1.php', false));
     }
     M::sendMessage($userId, array($receiver), array('create_uid' => $winduid, 'create_username' => $windid, 'title' => S::escapeChar(stripslashes($subject)), 'content' => S::escapeChar(stripslashes($content))));
     return new ApiResponse(true);
 }
Exemplo n.º 16
0
 public function run()
 {
     //获取是经销商还是服务店菜单
     $params = M::getRoot();
     //组装参数
     $params["scope"] = "sliderbar";
     //指定定查询范围
     //获取菜单数组
     $navarr = FrontMenu::getChildMenu($params);
     foreach ($navarr as $key => $val) {
         if ($val['name'] != '信息管理') {
             unset($navarr[$key]);
             continue;
         }
     }
     $this->render('topNav', array('permenu' => $navarr));
 }
Exemplo n.º 17
0
 public static function __callStatic($sTemplate, $aArgs)
 {
     if ($aDirs = M::TEMPLATE_PHP()) {
         foreach ($aDirs as $sDir) {
             $sPath = M::PROJECT_ROOT() . '/' . $sDir . '/tpl.' . $sTemplate . '.php';
             if (file_exists($sPath)) {
                 self::_findJsFile($sTemplate);
                 self::_findCssFile($sTemplate);
                 if (isset($aArgs[0])) {
                     print Processor::evalString(file_get_contents($sPath), $aArgs[0]);
                 }
                 return;
             }
         }
     }
     throw new Exception("Template \"{$sTemplate}\" is not found");
 }
Exemplo n.º 18
0
 public static function connect($sDb = null, $sHost = null, $sUser = null, $sPass = null)
 {
     self::disconnect();
     $sHost = $sHost ? $sHost : M::DB_HOST();
     $sUser = $sUser ? $sUser : M::DB_USER();
     $sPass = $sPass ? $sPass : M::DB_PASSWORD();
     $sDb = $sDb ? $sDb : M::DB_NAME();
     self::$_oDb = new mysqli($sHost, $sUser, $sPass, $sDb);
     self::$_oDb->set_charset('utf8');
     if (self::$_oDb->connect_errno) {
         switch (self::$_oDb->connect_errno) {
             case 2002:
                 throw new Exception('Mysql error: MYSQL SERVER IS DOWN');
             default:
                 throw new Exception('Mysql error: (' . self::$_oDb->connect_errno . ') ' . self::$_oDb->connect_error);
         }
     }
 }
Exemplo n.º 19
0
 public static function up2Web($img)
 {
     $msg = array();
     $fname = self::name(DATAROOT, 'up_', pathinfo($img['name']));
     $valid = self::validate($img, $fname);
     if (!$valid->success) {
         return M::cr(false, array(), $valid->msg);
     }
     // final move
     if (!move_uploaded_file($img['tmp_name'], DATAROOT . $fname)) {
         $msg[] = 'Failed to move uploaded file ' . $img['tmp_name'] . ' to ' . $fname;
     }
     // Check if $uploadOk is set to 0 by an error
     if (count($msg) > 0) {
         return M::cr(false, array(), implode(',', $msg));
     } else {
         return M::cr(true, array($fname));
     }
 }
Exemplo n.º 20
0
 public function execute($params)
 {
     if (count($params) > 0) {
         $tables = $params;
     } else {
         $tables = M::tablesWithPlugin('tag');
     }
     foreach ($tables as $table) {
         $records = DB_DataObject::factory($table);
         $records->find();
         $records->unloadPlugins();
         $this->line('');
         $this->line("clearing cache on {$table}");
         foreach ($records as $record) {
             $record->getPlugin('tag')->clearTagCache($record);
             echo '.';
         }
     }
 }
Exemplo n.º 21
0
 public function run()
 {
     //大类子类数据源
     $main = DefaultService::getMainCategorys(0);
     $main = DefaultService::findChild($main, 0);
     $maincate = DefaultService::findsub($main);
     //获取是经销商还是服务店菜单
     $params = M::getRoot();
     //组装参数
     $params["scope"] = "sliderbar";
     //指定定查询范围
     //获取菜单数组
     $navarr = FrontMenu::getChildMenu($params);
     foreach ($navarr as $key => $val) {
         if ($val['name'] != '信息管理') {
             unset($navarr[$key]);
             continue;
         }
     }
     $this->render('topNav', array('MainCategory' => $maincate, 'permenu' => $navarr));
 }
Exemplo n.º 22
0
 /**
  *  Absolutize to current url – use in templates
  */
 public static function absolutize($sUrl, $sPort = null)
 {
     /* return if already absolute URL */
     if (parse_url($sUrl, PHP_URL_SCHEME) != '') {
         return $sUrl;
     }
     /* queries and anchors */
     if (!$sUrl || $sUrl[0] == '#' || $sUrl[0] == '?') {
         return M::SITE_ROOT() . $sUrl;
     }
     /* parse base URL and convert to local variables:
     			$scheme, $host, $path */
     extract(parse_url(M::SITE_ROOT()));
     /* remove non-directory element from path */
     // $path = preg_replace('#/[^/]*$#', '', $path);
     if (!isset($scheme)) {
         $scheme = '';
     } else {
         $scheme = $scheme . ':';
     }
     if (!isset($host)) {
         $host = '';
     }
     if (!isset($path)) {
         $path = '';
     }
     if ($sPort) {
         $host = $host . ':' . $sPort;
     }
     /* destroy path if relative url points to root */
     //if ($sUrl[0] == '/') { $path = ''; }
     /* dirty absolute URL */
     $sAbs = "{$host}{$path}/{$sUrl}";
     /* replace '//' or '/./' or '/foo/../' with '/' */
     $aRegex = array('#(/\\.?/)#', '#/(?!\\.\\.)[^/]+/\\.\\./#');
     for ($n = 1; $n > 0; $sAbs = preg_replace($aRegex, '/', $sAbs, -1, $n)) {
     }
     /* absolute URL is ready! */
     return $scheme . '//' . $sAbs;
 }
Exemplo n.º 23
0
                $errorname = $sendtoname;
                Showmsg('user_not_exists');
            }
            $uids[] = $userId;
        }
        if (is_array($touid)) {
            foreach ($touid as $key => $value) {
                if (is_numeric($value)) {
                    $uids[] = $value;
                }
            }
        }
        !$uids && Showmsg('msg_empty');
        $toUsers = $userService->getUserNamesByUserIds($uids);
        $inColonyUsers = array();
        $query = $db->query("SELECT username FROM pw_cmembers WHERE uid IN(" . S::sqlImplode($uids) . ") AND colonyid=" . S::sqlEscape($cyid));
        while ($rt = $db->fetch_array($query)) {
            $inColonyUsers[] = $rt['username'];
        }
        $toUsers = array_diff($toUsers, $inColonyUsers);
        M::sendRequest($winduid, $toUsers, array('create_uid' => $winduid, 'create_username' => $windid, 'title' => getLangInfo('writemsg', 'email_' . $type . '_invite_subject'), 'content' => getLangInfo('writemsg', 'email_' . $type . '_invite_content'), 'extra' => serialize(array('cyid' => $id))), 'request_group', 'request_group');
        if ($inColonyUsers) {
            $inColonyUsers = implode(',', $inColonyUsers);
            Showmsg('colony_invite_message');
        } else {
            Showmsg('operate_success');
        }
    }
} else {
    Showmsg('undefined_action');
}
Exemplo n.º 24
0
Arquivo: init.php Projeto: demental/m
<?php

M::addPath('module', dirname(__FILE__) . '/modules/');
M::addPath('template', dirname(__FILE__) . '/templates/');
Exemplo n.º 25
0
<?php

!function_exists('readover') && exit('Forbidden');
$g = $db->get_one("SELECT p.gid,p.rvalue AS allowbuy,u.grouptitle FROM pw_permission p LEFT JOIN pw_usergroups u ON p.gid=u.gid WHERE p.uid='0' AND p.fid='0' AND p.gid=" . S::sqlEscape($rt['paycredit']) . " AND p.rkey='allowbuy' AND u.gptype='special'");
if ($g && $g['allowbuy']) {
    $userService = L::loadClass('UserService', 'user');
    /* @var $userService PW_UserService */
    if ($rt['extra_1'] == 1) {
        if ($rt['groupid'] == '-1') {
            $userService->update($rt['uid'], array('groupid' => $g['gid']));
        } else {
            $groups = $rt['groups'] ? $rt['groups'] . $rt['groupid'] . ',' : ",{$rt['groupid']},";
            $userService->update($rt['uid'], array('groupid' => $g['gid'], 'groups' => $groups));
        }
    } else {
        $groups = $rt['groups'] ? $rt['groups'] . $g['gid'] . ',' : ",{$g['gid']},";
        $userService->update($rt['uid'], array('groups' => $groups));
    }
    $db->pw_update("SELECT uid FROM pw_extragroups WHERE uid=" . S::sqlEscape($rt['uid']) . " AND gid=" . S::sqlEscape($g['gid']), "UPDATE pw_extragroups SET " . S::sqlSingle(array('togid' => $rt['groupid'], 'startdate' => $timestamp, 'days' => $rt['number'])) . " WHERE uid=" . S::sqlEscape($rt['uid']) . " AND gid=" . S::sqlEscape($g['gid']), "INSERT INTO pw_extragroups SET " . S::sqlSingle(array('uid' => $rt['uid'], 'togid' => $rt['groupid'], 'gid' => $g['gid'], 'startdate' => $timestamp, 'days' => $rt['number'])));
    M::sendNotice(array($rt['username']), array('title' => getLangInfo('writemsg', 'groupbuy_title'), 'content' => getLangInfo('writemsg', 'groupbuy_content', array('fee' => $fee, 'gname' => $g['grouptitle'], 'number' => $rt['number']))));
    $ret_url = 'profile.php?action=buy';
}
Exemplo n.º 26
0
 function updateUserInfo($type, $add, $content = '')
 {
     global $db_creditset, $credit, $db_upgrade, $timestamp, $db_tcheck;
     if ($this->groupid != 'guest') {
         require_once R_P . 'require/credit.php';
         $this->user['todaypost']++;
         $this->user['monthpost']++;
         $this->user['postnum']++;
         $this->user['lastpost'] = $timestamp;
         $credit->addLog('topic_' . $type, $add, array('uid' => $this->uid, 'username' => $this->username, 'ip' => $GLOBALS['onlineip'], 'fname' => $this->forum->name));
         $credit->sets($this->uid, $add, false);
         $this->user['rvrc'] += $add['rvrc'];
         $this->user['money'] += $add['money'];
         $this->user['credit'] += $add['credit'];
         $this->user['currency'] += $add['currency'];
         $usercredit = array('postnum' => $this->user['postnum'], 'digests' => $this->user['digests'], 'rvrc' => $this->user['rvrc'], 'money' => $this->user['money'], 'credit' => $this->user['credit'], 'currency' => $this->user['currency'], 'onlinetime' => $this->user['onlinetime']);
         $upgradeset = unserialize($db_upgrade);
         foreach ($upgradeset as $key => $val) {
             if (is_numeric($key) && $val) {
                 foreach ($credit->get($this->user['uid'], 'CUSTOM') as $key => $value) {
                     $usercredit[$key] = $value;
                 }
                 break;
             }
         }
         require_once R_P . 'require/functions.php';
         $memberid = getmemberid(CalculateCredit($usercredit, $upgradeset));
         $userService = L::loadClass('UserService', 'user');
         /* @var $userService PW_UserService */
         if ($this->user['memberid'] != $memberid) {
             $userService->update($this->user['uid'], array('memberid' => $memberid));
             $membername = getMembername($memberid);
             $upmemberid = getNextMemberid($memberid);
             $upmembername = getMembername($upmemberid);
             $upneedcredit = getmemberNeed($upmemberid);
             $userneed = $upneedcredit - CalculateCredit($usercredit, $upgradeset);
             M::sendNotice(array($this->user['username']), array('title' => getLangInfo('writemsg', 'user_update_title', array('username' => $windid)), 'content' => getLangInfo('writemsg', 'user_update_content', array('membername' => $membername, 'upmembername' => $upmembername, 'username' => $this->user['username'], 'userneed' => $userneed))));
             //$data=array('uid'=>$this->user['uid'],'behavior'=>5,'lastday'=>$GLOBALS['tdtime'],'num'=>$memberid);
             //$data=array('uid'=>1,'behavior'=>5,'lastday'=>123,'num'=>1);
             $this->elementUpdate($this->user['uid']);
             /*升级记录排行*/
         }
         $pwSQL = array('postnum' => $this->user['postnum'], 'todaypost' => $this->user['todaypost'], 'monthpost' => $this->user['monthpost'], 'lastpost' => $this->user['lastpost'], 'uploadtime' => $this->user['uploadtime'], 'uploadnum' => $this->user['uploadnum']);
         if ($db_tcheck) {
             $postcheck = unserialize($this->user['postcheck']);
             $this->fromGroup ? $postcheck['group'] = PwPost::tcheck($content) : ($postcheck['post'] = PwPost::tcheck($content));
             $pwSQL['postcheck'] = serialize($postcheck);
         }
         $userService->update($this->uid, array(), $pwSQL);
         $credit->runsql();
         /**
         			if (!array_sum($add)) {
         				$_cache = getDatastore();
         				$_cache->delete('UID_'.$this->uid);
         			}
         			**/
     } else {
         Cookie('userlastptime', $timestamp);
     }
 }
Exemplo n.º 27
0
        S::gp(array('password'));
        S::gp(array('newmanager'), 'GP', 2);
        if (!threadSetCheckOwnerPassword($winduid, $password)) {
            Showmsg('您输入的密码不正确!');
        }
        $userdb = $db->get_one("SELECT m.username,m.groupid,m.memberid FROM pw_cmembers c LEFT JOIN pw_members m ON c.uid=m.uid WHERE c.ifadmin='1' AND c.colonyid=" . S::sqlEscape($cyid) . ' AND c.uid=' . S::sqlEscape($newmanager));
        if (empty($userdb)) {
            Showmsg('请选择要转让的用户!');
        }
        $userdb['groupid'] == '-1' && ($userdb['groupid'] = $userdb['memberid']);
        if ($o_groups && strpos($o_groups, ',' . $userdb['groupid'] . ',') === false) {
            Showmsg('您选择的用户没有接受的权限!');
        }
        //* $db->update("UPDATE pw_colonys SET admin=" . S::sqlEscape($userdb['username']) . ' WHERE id=' . S::sqlEscape($cyid));
        pwQuery::update('pw_colonys', 'id=:id', array($cyid), array('admin' => $userdb['username']));
        M::sendNotice(array($userdb['username']), array('title' => getLangInfo('writemsg', 'group_attorn_title'), 'content' => getLangInfo('writemsg', 'group_attorn_content', array('username' => $windid, 'cyid' => $cyid, 'cname' => $colony['cname'], 'descrip' => $colony['descrip']))));
        refreshto("thread.php?cyid={$cyid}", '转让群组成功!');
    }
} elseif ($t == 'disband') {
    if (!($windid == $colony['admin'] && $groupRight['allowdisband'] || $groupid == '3')) {
        Showmsg('colony_out_right');
    }
    if (empty($_POST['step'])) {
        require_once PrintEot('thread_set');
        footer();
    } else {
        S::gp(array('password'));
        if (!threadSetCheckOwnerPassword($winduid, $password)) {
            Showmsg('您输入的密码不正确!');
        }
        if ($db->get_value("SELECT COUNT(*) as sum FROM pw_cnalbum WHERE atype=1 AND ownerid=" . S::sqlEscape($cyid)) > 0) {
Exemplo n.º 28
0
function sendMawholeMessages($msgdb)
{
    foreach ($msgdb as $key => $val) {
        M::sendNotice(array($val['toUser']), array('title' => $val['title'], 'content' => $val['content']));
    }
}
Exemplo n.º 29
0
if ($hash == appkey($o_u, $app) && $winduid && $o_u !== $winduid) {
    $userService = L::loadClass('UserService', 'user');
    /* @var $userService PW_UserService */
    $ckuser = $userService->get($o_u);
    $iffriend = $friendServer->getFriendByUidAndFriendid($winduid, $o_u);
    if ($ckuser && empty($iffriend)) {
        $friendcheck = getstatus($ckuser['userstatus'], PW_USERSTATUS_CFGFRIEND, 3);
        if (!$friendcheck) {
            $db->query("DELETE FROM pw_attention WHERE uid=" . S::sqlEscape($winduid) . " AND friendid=" . S::sqlEscape($o_u));
            addSingleFriend(true, $winduid, $o_u, $timestamp, 0);
            addSingleFriend(true, $o_u, $winduid, $timestamp, 0);
            M::sendNotice(array($ckuser['username']), array('title' => getLangInfo('writemsg', 'friend_add_title_1', array('username' => $windid)), 'content' => getLangInfo('writemsg', 'friend_add_content_1', array('uid' => $winduid, 'username' => $windid))));
        } elseif ($friendcheck == 1) {
            $db->query("DELETE FROM pw_attention WHERE uid=" . S::sqlEscape($winduid) . " AND friendid=" . S::sqlEscape($touid));
            addSingleFriend(false, $winduid, $o_u, $timestamp, 1);
            M::sendRequest($winduid, array($ckuser['username']), array('create_uid' => $winduid, 'create_username' => $windid, 'title' => getLangInfo('writemsg', 'friend_add_title_2', array('username' => $windid)), 'content' => getLangInfo('writemsg', 'friend_add_content_2', array('uid' => $winduid, 'username' => $windid, 'msg' => stripslashes($checkmsg)))), 'request_friend', 'request_friend');
        }
        Cookie('o_invite', '');
    }
}
function addSingleFriend($updatemem, $winduid, $frienduid, $timestamp, $status, $friendtype = 0, $checkmsg = '')
{
    global $db;
    $pwSQL = S::sqlSingle(array('uid' => $winduid, 'friendid' => $frienduid, 'joindate' => $timestamp, 'status' => $status, 'descrip' => $checkmsg, 'ftid' => $friendtype));
    $attentionService = L::loadClass('Attention', 'friend');
    /* @var $attentionService PW_Attention */
    if ($isAttention = $attentionService->isFollow($winduid, $frienduid)) {
        $db->update("UPDATE pw_friends SET status = 0 WHERE uid=" . S::sqlEscape($winduid) . " AND friendid=" . S::sqlEscape($frienduid));
    } else {
        if ($winduid != $frienduid) {
            $db->update("INSERT INTO pw_friends SET {$pwSQL}");
Exemplo n.º 30
0
        adminmsg('operate_success');
    }
} elseif ($_POST['pass']) {
    S::gp(array('deiaid'), 'P');
    if (!$deiaid) {
        adminmsg('operate_error');
    }
    foreach ($deiaid as $sid) {
        $db->update("UPDATE pw_sharelinks SET ifcheck=1 WHERE sid=" . S::sqlEscape($sid));
    }
    $temp = array();
    $rs = $db->query("SELECT username FROM pw_sharelinks WHERE sid IN(" . S::sqlImplode($deiaid) . ")");
    while ($rt = $db->fetch_array($rs)) {
        $temp[] = $rt['username'];
    }
    M::sendNotice($temp, array('title' => getLangInfo('writemsg', 'sharelink_pass_title'), 'content' => getLangInfo('writemsg', 'sharelink_pass_content')));
    updatecache_i();
    adminmsg('operate_success');
} elseif ($_POST['unpass']) {
    S::gp(array('deiaid'), 'P');
    if (!$deiaid) {
        adminmsg('operate_error');
    }
    foreach ($deiaid as $sid) {
        $db->update("UPDATE pw_sharelinks SET ifcheck=0 WHERE sid=" . S::sqlEscape($sid));
    }
    updatecache_i();
    adminmsg('operate_success');
} elseif ($_POST['delete']) {
    S::gp(array('deiaid'), 'P');
    if (!$deiaid) {