Example #1
0
            $app = $_POST['app'];
            $wt_open->delete(array('pid' => $pid));
            foreach ($app as $key => $value) {
                $tableInfo = array('pid' => $pid, 'name' => $key, 'app_key' => trim($value['key']), 'app_secret' => trim($value['secret']), 'callback' => trim($value['callback']), 'status' => $value['key'] && $value['secret'], 'user' => Passport::GetLoginName());
                $wt_open->replace($tableInfo);
            }
            $TEMPLATE['error']['app'] = '<span style="color:#090">保存成功!</span>';
        }
        break;
    case 'delete':
        $wt_open->update(array('status' => -1), array('id' => $pid));
        $wt_open->update(array('status' => -1), array('pid' => $pid));
        redirect('?');
        break;
}
$TEMPLATE['title'] = '平台设定';
$TEMPLATE['login_name'] = Passport::GetLoginName();
$TEMPLATE['nav']['platform'] = 'current';
$TEMPLATE['platform_list'] = $wt_open->getPlatformList(false);
$TEMPLATE['open_list'] = Config::open_list();
if ($pid > 0) {
    $TEMPLATE['pid'] = $pid;
    $TEMPLATE['open_data'] = $wt_open->findBy(array('pid' => $pid), 'name');
    //var_dump($TEMPLATE['open_data']);
    foreach ($TEMPLATE['open_list'] as $key => &$value) {
        $value = array_merge(array('weibo_name' => $value), (array) $TEMPLATE['open_data'][$key]);
        unset($value);
    }
}
$smarty = new Template();
echo $smarty->r('platform');
Example #2
0
 /**
  * 按平台和权限获取博客列表
  * @param int $pid
  * @param bool $perm
  */
 public function getBlogList($pid = 0, $perm = TRUE)
 {
     if ($pid == 0) {
         return array();
     }
     if ($perm) {
         $user = new User();
         $perms = $user->getPerms(Passport::GetLoginUid());
         if (!array_key_exists($pid, $perms)) {
             return array();
         }
     }
     $list = Config::blog_list();
     if ($pid > 0) {
         $set_list = $this->findBy(array('status' => 1, 'pid' => $pid), 'name');
         $new_list = array();
         foreach ($list as $key => $value) {
             if (array_key_exists($key, $set_list) || array_key_exists($key, Config::simula_list())) {
                 $new_list[$key] = $list[$key];
             }
         }
         $list = $new_list;
     } else {
         foreach ($list as $key => $value) {
             if ($key == 'qzone_simula') {
                 //	只要设定任何一个 qzone APPKEY,qzone模拟登录就关闭
                 if ($this->fetchOne(array('status' => 1, 'name' => 'qzone'))) {
                     unset($list[$key]);
                     continue;
                 }
             }
             if (array_key_exists($key, Config::open_list())) {
                 unset($list[$key]);
             }
         }
     }
     return $list;
 }